Index: Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs =================================================================== diff -u -r51d81c14322618f93a2c9cdf46276c4f2c5ee9fb -r9a4eded3d7de675594c149438dbc9512674cc5c2 --- Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs (.../ObjectProperties.cs) (revision 51d81c14322618f93a2c9cdf46276c4f2c5ee9fb) +++ Core/Common/src/Core.Common.Gui/PropertyBag/ObjectProperties.cs (.../ObjectProperties.cs) (revision 9a4eded3d7de675594c149438dbc9512674cc5c2) @@ -46,7 +46,7 @@ } [Browsable(false)] - public virtual object Data + public object Data { get { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationsProperties.cs =================================================================== diff -u -r51d81c14322618f93a2c9cdf46276c4f2c5ee9fb -r9a4eded3d7de675594c149438dbc9512674cc5c2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationsProperties.cs (.../HydraulicBoundaryLocationsProperties.cs) (revision 51d81c14322618f93a2c9cdf46276c4f2c5ee9fb) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationsProperties.cs (.../HydraulicBoundaryLocationsProperties.cs) (revision 9a4eded3d7de675594c149438dbc9512674cc5c2) @@ -45,25 +45,14 @@ throw new ArgumentNullException(nameof(hydraulicBoundaryLocations)); } - hydraulicBoundaryLocationObserver = new RecursiveObserver, HydraulicBoundaryLocation>(OnRefreshRequired, list => list); + hydraulicBoundaryLocationObserver = new RecursiveObserver, HydraulicBoundaryLocation>(OnRefreshRequired, list => list) + { + Observable = hydraulicBoundaryLocations + }; Data = hydraulicBoundaryLocations; } - public override object Data - { - get - { - return base.Data; - } - set - { - base.Data = value; - - hydraulicBoundaryLocationObserver.Observable = value as ObservableList; - } - } - public override void Dispose() { hydraulicBoundaryLocationObserver.Dispose(); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs =================================================================== diff -u -rcedf973769c057c935ffce89259027f2ea13c4df -r9a4eded3d7de675594c149438dbc9512674cc5c2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs (.../HydraulicBoundaryLocationsPropertiesTest.cs) (revision cedf973769c057c935ffce89259027f2ea13c4df) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationsPropertiesTest.cs (.../HydraulicBoundaryLocationsPropertiesTest.cs) (revision 9a4eded3d7de675594c149438dbc9512674cc5c2) @@ -88,66 +88,6 @@ Assert.AreEqual(0, refreshRequiredRaised); } - [Test] - public void GivenPropertyControlWithNewData_WhenSingleLocationUpdatedInPreviouslySetData_RefreshRequiredEventNotRaised() - { - // Given - HydraulicBoundaryLocation location1 = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.5); - HydraulicBoundaryLocation location2 = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.5); - var hydraulicBoundaryLocations1 = new ObservableList - { - location1 - }; - var hydraulicBoundaryLocations2 = new ObservableList - { - location2 - }; - - var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations1) - { - Data = hydraulicBoundaryLocations2 - }; - - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - - // When - location1.NotifyObservers(); - - // Then - Assert.AreEqual(0, refreshRequiredRaised); - } - - [Test] - public void GivenPropertyControlWithNewData_WhenSingleLocationUpdatedInNewlySetData_RefreshRequiredEventRaised() - { - // Given - HydraulicBoundaryLocation location1 = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.5); - HydraulicBoundaryLocation location2 = TestHydraulicBoundaryLocation.CreateDesignWaterLevelCalculated(1.5); - var hydraulicBoundaryLocations1 = new ObservableList - { - location1 - }; - var hydraulicBoundaryLocations2 = new ObservableList - { - location2 - }; - - var properties = new TestHydraulicBoundaryLocationsProperties(hydraulicBoundaryLocations1) - { - Data = hydraulicBoundaryLocations2 - }; - - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - - // When - location2.NotifyObservers(); - - // Then - Assert.AreEqual(1, refreshRequiredRaised); - } - private class TestHydraulicBoundaryLocationsProperties : HydraulicBoundaryLocationsProperties { public TestHydraulicBoundaryLocationsProperties(ObservableList hydraulicBoundaryLocations) Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationsProperties.cs =================================================================== diff -u -r51d81c14322618f93a2c9cdf46276c4f2c5ee9fb -r9a4eded3d7de675594c149438dbc9512674cc5c2 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationsProperties.cs (.../DuneLocationsProperties.cs) (revision 51d81c14322618f93a2c9cdf46276c4f2c5ee9fb) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/PropertyClasses/DuneLocationsProperties.cs (.../DuneLocationsProperties.cs) (revision 9a4eded3d7de675594c149438dbc9512674cc5c2) @@ -59,27 +59,16 @@ throw new ArgumentNullException(nameof(getCalculationFunc)); } - locationObserver = new RecursiveObserver, DuneLocation>(OnRefreshRequired, list => list); + locationObserver = new RecursiveObserver, DuneLocation>(OnRefreshRequired, list => list) + { + Observable = locations + }; this.getCalculationFunc = getCalculationFunc; Data = locations; } - public override object Data - { - get - { - return base.Data; - } - set - { - base.Data = value; - - locationObserver.Observable = value as ObservableList; - } - } - [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.HydraulicBoundaryDatabase_Locations_DisplayName))] Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs =================================================================== diff -u -r14dff458c62c80737fd2ddb9c64c72044f6b8f5a -r9a4eded3d7de675594c149438dbc9512674cc5c2 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs (.../DuneLocationsPropertiesTest.cs) (revision 14dff458c62c80737fd2ddb9c64c72044f6b8f5a) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneLocationsPropertiesTest.cs (.../DuneLocationsPropertiesTest.cs) (revision 9a4eded3d7de675594c149438dbc9512674cc5c2) @@ -152,65 +152,5 @@ // Then Assert.AreEqual(0, refreshRequiredRaised); } - - [Test] - public void GivenPropertyControlWithNewData_WhenSingleLocationUpdatedInPreviouslySetData_RefreshRequiredEventNotRaised() - { - // Given - DuneLocation location1 = new TestDuneLocation(); - DuneLocation location2 = new TestDuneLocation(); - var duneLocations1 = new ObservableList - { - location1 - }; - var duneLocations2 = new ObservableList - { - location2 - }; - - var properties = new DuneLocationsProperties(duneLocations1, l => new DuneLocationCalculation()) - { - Data = duneLocations2 - }; - - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - - // When - location1.NotifyObservers(); - - // Then - Assert.AreEqual(0, refreshRequiredRaised); - } - - [Test] - public void GivenPropertyControlWithNewData_WhenSingleLocationUpdatedInNewlySetData_RefreshRequiredEventRaised() - { - // Given - DuneLocation location1 = new TestDuneLocation(); - DuneLocation location2 = new TestDuneLocation(); - var duneLocations1 = new ObservableList - { - location1 - }; - var duneLocations2 = new ObservableList - { - location2 - }; - - var properties = new DuneLocationsProperties(duneLocations1, l => new DuneLocationCalculation()) - { - Data = duneLocations2 - }; - - var refreshRequiredRaised = 0; - properties.RefreshRequired += (sender, args) => refreshRequiredRaised++; - - // When - location2.NotifyObservers(); - - // Then - Assert.AreEqual(1, refreshRequiredRaised); - } } } \ No newline at end of file