Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/VariationCoefficientDistributionPropertiesBase.cs =================================================================== diff -u -r8805f03189f521994b42a519bbca7561bf12eb68 -rdbfba4c1829b1d42f4d99a88f7d8699bc3beeb2a --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/VariationCoefficientDistributionPropertiesBase.cs (.../VariationCoefficientDistributionPropertiesBase.cs) (revision 8805f03189f521994b42a519bbca7561bf12eb68) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/VariationCoefficientDistributionPropertiesBase.cs (.../VariationCoefficientDistributionPropertiesBase.cs) (revision dbfba4c1829b1d42f4d99a88f7d8699bc3beeb2a) @@ -40,7 +40,8 @@ private readonly string variationCoefficientDisplayName; private readonly bool isMeanReadOnly; private readonly bool isVariationCoefficientReadOnly; - private readonly IObservable observerable; + private readonly IObservable observable; + private readonly IPropertyChangeHandler changeHandler; /// /// Initializes a new instance of the class. @@ -49,10 +50,13 @@ /// marked as read-only. /// The object to be notified of changes to properties. /// Can be null if all properties are marked as read-only by . + /// Optional handler that is used to handle property changes. /// Thrown when /// is null and any number of properties in this class is editable. - protected VariationCoefficientDistributionPropertiesBase(VariationCoefficientDistributionPropertiesReadOnly propertiesReadOnly, - IObservable observable) + protected VariationCoefficientDistributionPropertiesBase( + VariationCoefficientDistributionPropertiesReadOnly propertiesReadOnly, + IObservable observable, + IPropertyChangeHandler handler) { if (observable == null && !propertiesReadOnly.HasFlag(VariationCoefficientDistributionPropertiesReadOnly.All)) { @@ -65,7 +69,8 @@ meanDisplayName = TypeUtils.GetMemberName>(d => d.Mean); variationCoefficientDisplayName = TypeUtils.GetMemberName>(d => d.CoefficientOfVariation); - observerable = observable; + this.observable = observable; + changeHandler = handler; } [PropertyOrder(1)] @@ -89,7 +94,7 @@ throw new InvalidOperationException("Mean is set to be read-only."); } data.Mean = value; - observerable.NotifyObservers(); + NotifyPropertyChanged(); } } @@ -109,7 +114,7 @@ throw new InvalidOperationException("CoefficientOfVariation is set to be read-only."); } data.CoefficientOfVariation = value; - observerable.NotifyObservers(); + NotifyPropertyChanged(); } } @@ -133,5 +138,17 @@ string.Format("{0} ({1} = {2})", Mean, Resources.Distribution_VariationCoefficient_DisplayName, CoefficientOfVariation); } + + /// + /// Sends notifications due to a change of a property. + /// + protected void NotifyPropertyChanged() + { + if (changeHandler != null) + { + changeHandler.PropertyChanged(); + } + observable.NotifyObservers(); + } } } \ No newline at end of file