Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionPropertiesBase.cs =================================================================== diff -u -r8805f03189f521994b42a519bbca7561bf12eb68 -r68953cc654409e65478d6aa4fb8c1cf44b116d9d --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionPropertiesBase.cs (.../DistributionPropertiesBase.cs) (revision 8805f03189f521994b42a519bbca7561bf12eb68) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionPropertiesBase.cs (.../DistributionPropertiesBase.cs) (revision 68953cc654409e65478d6aa4fb8c1cf44b116d9d) @@ -41,6 +41,7 @@ private readonly bool isMeanReadOnly; private readonly bool isStandardDeviationReadOnly; private readonly IObservable observable; + private readonly IChangeHandler changeHandler; /// /// Initializes a new instance of the class. @@ -49,9 +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 . + /// The handler that is used to handle property changes. /// Thrown when /// is null and any number of properties in this class is editable. - protected DistributionPropertiesBase(DistributionPropertiesReadOnly propertiesReadOnly, IObservable observable) + protected DistributionPropertiesBase( + DistributionPropertiesReadOnly propertiesReadOnly, + IObservable observable, + IChangeHandler handler) { if (observable == null && !propertiesReadOnly.HasFlag(DistributionPropertiesReadOnly.All)) { @@ -65,6 +70,7 @@ standardDeviationPropertyName = TypeUtils.GetMemberName>(rd => rd.StandardDeviation); this.observable = observable; + changeHandler = handler; } [PropertyOrder(1)] @@ -88,7 +94,7 @@ throw new ArgumentException("Mean is set to be read-only."); } data.Mean = value; - observable.NotifyObservers(); + NotifyPropertyChanged(); } } @@ -108,7 +114,7 @@ throw new ArgumentException("StandardDeviation is set to be read-only."); } data.StandardDeviation = value; - observable.NotifyObservers(); + NotifyPropertyChanged(); } } @@ -132,5 +138,29 @@ string.Format("{0} ({1} = {2})", Mean, Resources.NormalDistribution_StandardDeviation_DisplayName, StandardDeviation); } + + /// + /// Sends notifications due to a change of a property. + /// + protected void NotifyPropertyChanged() + { + if (changeHandler != null) + { + changeHandler.PropertyChanged(); + } + observable.NotifyObservers(); + } + + /// + /// Interface defining the operations of handling a change of . + /// + public interface IChangeHandler + { + /// + /// Defines the action that is executed after a property of + /// has been changed. + /// + void PropertyChanged(); + } } } \ No newline at end of file