Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs
===================================================================
diff -u -rc0849c80b8bab9023c7df1e8402aa380891496d2 -rdbfba4c1829b1d42f4d99a88f7d8699bc3beeb2a
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision c0849c80b8bab9023c7df1e8402aa380891496d2)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/StructuresInputBaseProperties.cs (.../StructuresInputBaseProperties.cs) (revision dbfba4c1829b1d42f4d99a88f7d8699bc3beeb2a)
@@ -40,6 +40,7 @@
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.Properties;
using Ringtoets.Common.Forms.UITypeEditors;
+using Ringtoets.Common.Service;
namespace Ringtoets.Common.Forms.PropertyClasses
{
@@ -174,23 +175,21 @@
///
/// The type of the wrapped data to set a probability value for.
/// The probability value to set.
- /// The wrapped data to set a probability value for.
+ /// The wrapped data to set a probability value for.
/// The action that sets the probability value to a specific property of the wrapped data.
/// Thrown when equals null.
/// Thrown when cannot be parsed into a double.
- /// After correctly setting the to the wrapped data, observers will be notified.
- protected static void SetProbabilityValue(string value,
- T wrappedData,
- Action setValueAction)
- where T : IObservable
+ protected static void SetProbabilityValue(string value,
+ TStructureInput structureInput,
+ Action setValueAction)
{
if (value == null)
{
throw new ArgumentNullException("value", Resources.FailureProbability_Value_cannot_be_null);
}
try
{
- setValueAction(wrappedData, (RoundedDouble) double.Parse(value));
+ setValueAction(structureInput, (RoundedDouble) double.Parse(value));
}
catch (OverflowException)
{
@@ -200,7 +199,6 @@
{
throw new ArgumentException(Resources.FailureProbability_Could_not_parse_string_to_double_value);
}
- wrappedData.NotifyObservers();
}
private static string GetMemberName(Expression, object>> expression)
@@ -318,7 +316,7 @@
{
data.WrappedData.Structure = value;
AfterSettingStructure();
- data.WrappedData.NotifyObservers();
+ ClearOutputAndNotifyPropertyChanged();
}
}
@@ -350,7 +348,7 @@
set
{
data.WrappedData.StructureNormalOrientation = value;
- data.WrappedData.NotifyObservers();
+ ClearOutputAndNotifyPropertyChanged();
}
}
@@ -379,7 +377,10 @@
{
get
{
- return new VariationCoefficientNormalDistributionProperties(VariationCoefficientDistributionPropertiesReadOnly.None, data.WrappedData)
+ return new VariationCoefficientNormalDistributionProperties(
+ VariationCoefficientDistributionPropertiesReadOnly.None,
+ data.WrappedData,
+ this)
{
Data = data.WrappedData.WidthFlowApertures
};
@@ -395,7 +396,10 @@
{
get
{
- return new VariationCoefficientLogNormalDistributionProperties(VariationCoefficientDistributionPropertiesReadOnly.None, data.WrappedData)
+ return new VariationCoefficientLogNormalDistributionProperties(
+ VariationCoefficientDistributionPropertiesReadOnly.None,
+ data.WrappedData,
+ this)
{
Data = data.WrappedData.StorageStructureArea
};
@@ -427,7 +431,10 @@
{
get
{
- return new VariationCoefficientLogNormalDistributionProperties(VariationCoefficientDistributionPropertiesReadOnly.None, data.WrappedData)
+ return new VariationCoefficientLogNormalDistributionProperties(
+ VariationCoefficientDistributionPropertiesReadOnly.None,
+ data.WrappedData,
+ this)
{
Data = data.WrappedData.CriticalOvertoppingDischarge
};
@@ -447,6 +454,7 @@
set
{
SetProbabilityValue(value, data.WrappedData, (wrappedData, parsedValue) => wrappedData.FailureProbabilityStructureWithErosion = parsedValue);
+ ClearOutputAndNotifyPropertyChanged();
}
}
@@ -464,7 +472,7 @@
set
{
data.WrappedData.ForeshoreProfile = value;
- data.WrappedData.NotifyObservers();
+ ClearOutputAndNotifyPropertyChanged();
}
}
@@ -516,7 +524,7 @@
set
{
data.WrappedData.HydraulicBoundaryLocation = value.HydraulicBoundaryLocation;
- data.WrappedData.NotifyObservers();
+ ClearOutputAndNotifyPropertyChanged();
}
}
@@ -529,7 +537,10 @@
{
get
{
- return new VariationCoefficientLogNormalDistributionProperties(VariationCoefficientDistributionPropertiesReadOnly.CoefficientOfVariation, data.WrappedData)
+ return new VariationCoefficientLogNormalDistributionProperties(
+ VariationCoefficientDistributionPropertiesReadOnly.CoefficientOfVariation,
+ data.WrappedData,
+ this)
{
Data = data.WrappedData.StormDuration
};
@@ -540,7 +551,22 @@
public void PropertyChanged()
{
- // TODO WTI-969/WTI-970/WTI-971/WTI-973
+ ClearCalculationOutput();
}
+
+ protected void ClearOutputAndNotifyPropertyChanged()
+ {
+ ClearCalculationOutput();
+ data.WrappedData.NotifyObservers();
+ }
+
+ private void ClearCalculationOutput()
+ {
+ IEnumerable affectedCalculation = RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(data.Calculation);
+ foreach (var calculation in affectedCalculation)
+ {
+ calculation.NotifyObservers();
+ }
+ }
}
}
\ No newline at end of file