Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs
===================================================================
diff -u -r57ef55e67931df024753fe19a636c02eaae148c1 -rdcd28600cb6af69cb49bf311b0fa61f78ad149be
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs) (revision 57ef55e67931df024753fe19a636c02eaae148c1)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs) (revision dcd28600cb6af69cb49bf311b0fa61f78ad149be)
@@ -39,22 +39,22 @@
///
public class HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler : IObservablePropertyChangeHandler
{
- private readonly HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability;
- private readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler));
+ private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler));
///
/// Creates a new instance of .
///
/// The calculations to change the target probability for.
/// Thrown when is null.
- public HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler(HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability)
+ public HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler(
+ HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability)
{
if (calculationsForTargetProbability == null)
{
throw new ArgumentNullException(nameof(calculationsForTargetProbability));
}
- this.calculationsForTargetProbability = calculationsForTargetProbability;
+ CalculationsForTargetProbability = calculationsForTargetProbability;
}
public IEnumerable SetPropertyValueAfterConfirmation(SetObservablePropertyValueDelegate setValue)
@@ -70,33 +70,40 @@
{
setValue();
- affectedObjects.AddRange(ClearHydraulicBoundaryLocationCalculationOutput());
- affectedObjects.Add(calculationsForTargetProbability);
+ affectedObjects.AddRange(ClearHydraulicBoundaryLocationCalculationDependentOutput());
+ affectedObjects.Add(CalculationsForTargetProbability);
}
return affectedObjects;
}
- private static bool ConfirmPropertyChange()
- {
- DialogResult result = MessageBox.Show(RiskeerCommonPluginResources.TargetProbabilityChangeHandler_Confirm_change_target_probability_and_clear_dependent_data,
- CoreCommonBaseResources.Confirm,
- MessageBoxButtons.OKCancel);
- return result == DialogResult.OK;
- }
+ ///
+ /// Gets the calculations to change the target probability for.
+ ///
+ protected HydraulicBoundaryLocationCalculationsForTargetProbability CalculationsForTargetProbability { get; }
- private IEnumerable ClearHydraulicBoundaryLocationCalculationOutput()
+ ///
+ /// Clears the hydraulic boundary location calculation dependent output.
+ ///
+ /// The affected objects.
+ protected virtual IEnumerable ClearHydraulicBoundaryLocationCalculationDependentOutput()
{
- IEnumerable affectedObjects = RiskeerDataSynchronizationService.ClearHydraulicBoundaryLocationCalculationOutput(calculationsForTargetProbability);
+ IEnumerable affectedObjects = RiskeerDataSynchronizationService.ClearHydraulicBoundaryLocationCalculationOutput(CalculationsForTargetProbability);
if (affectedObjects.Any())
{
log.Info(RiskeerCommonPluginResources.TargetProbabilityChangeHandler_Hydraulic_load_results_cleared);
-
- return affectedObjects;
}
- return Enumerable.Empty();
+ return affectedObjects;
}
+
+ private static bool ConfirmPropertyChange()
+ {
+ DialogResult result = MessageBox.Show(RiskeerCommonPluginResources.TargetProbabilityChangeHandler_Confirm_change_target_probability_and_clear_dependent_data,
+ CoreCommonBaseResources.Confirm,
+ MessageBoxButtons.OKCancel);
+ return result == DialogResult.OK;
+ }
}
}
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/WaterLevelHydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/WaterLevelHydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/WaterLevelHydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (revision dcd28600cb6af69cb49bf311b0fa61f78ad149be)
@@ -0,0 +1,65 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using Core.Common.Base;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Integration.Service;
+
+namespace Riskeer.Integration.Plugin.Handlers
+{
+ ///
+ /// Class responsible for changing the
+ /// value of a and clearing all dependent data.
+ ///
+ public class WaterLevelHydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler : HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler
+ {
+ private readonly IAssessmentSection assessmentSection;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The calculations to change the target probability for.
+ /// The the that contains the .
+ /// Thrown when any parameter is null.
+ public WaterLevelHydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler(
+ HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability, IAssessmentSection assessmentSection)
+ : base(calculationsForTargetProbability)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ this.assessmentSection = assessmentSection;
+ }
+
+ protected override IEnumerable ClearHydraulicBoundaryLocationCalculationDependentOutput()
+ {
+ var affectedObjects = new List();
+ affectedObjects.AddRange(base.ClearHydraulicBoundaryLocationCalculationDependentOutput());
+ affectedObjects.AddRange(RiskeerDataSynchronizationService.ClearAllWaveConditionsCalculationOutput(assessmentSection, CalculationsForTargetProbability));
+ return affectedObjects;
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandlerTest.cs
===================================================================
diff -u -r8c379b950333e45a56c901c937e705c8ac1e1c88 -rdcd28600cb6af69cb49bf311b0fa61f78ad149be
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandlerTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandlerTest.cs) (revision 8c379b950333e45a56c901c937e705c8ac1e1c88)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandlerTest.cs (.../HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandlerTest.cs) (revision dcd28600cb6af69cb49bf311b0fa61f78ad149be)
@@ -114,10 +114,10 @@
};
HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability = CreateCalculationsForTargetProbabilityWithAndWithoutOutput();
- List