Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler.cs (revision 7e097df29e12ff33d862f07ca7ec9cb5864ae608) @@ -0,0 +1,100 @@ +// 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 System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using log4net; +using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Forms.PropertyClasses; +using Riskeer.Integration.Plugin.Properties; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class responsible for changing the + /// value of a and clearing all dependent data. + /// + public class HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler : IObservablePropertyChangeHandler + { + private readonly HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability; + private 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) + { + if (calculationsForTargetProbability == null) + { + throw new ArgumentNullException(nameof(calculationsForTargetProbability)); + } + + this.calculationsForTargetProbability = calculationsForTargetProbability; + } + + public IEnumerable SetPropertyValueAfterConfirmation(SetObservablePropertyValueDelegate setValue) + { + if (setValue == null) + { + throw new ArgumentNullException(nameof(setValue)); + } + + var affectedObjects = new List(); + + if (ConfirmPropertyChange()) + { + setValue(); + + affectedObjects.AddRange(ClearHydraulicBoundaryLocationCalculationOutput()); + } + + return affectedObjects; + } + + private static bool ConfirmPropertyChange() + { + DialogResult result = MessageBox.Show(Resources.HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler_Confirm_change_target_probability_and_clear_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + private IEnumerable ClearHydraulicBoundaryLocationCalculationOutput() + { + IEnumerable affectedObjects = new List(); // Fixme + + if (affectedObjects.Any()) + { + log.Info(Resources.FailureMechanismContributionNormChangeHandler_Waveheight_and_design_water_level_results_cleared); + + return affectedObjects; + } + + return Enumerable.Empty(); + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r119d7f9ec28459422a25a3aa96034cb7c7c303ac -r7e097df29e12ff33d862f07ca7ec9cb5864ae608 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 119d7f9ec28459422a25a3aa96034cb7c7c303ac) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7e097df29e12ff33d862f07ca7ec9cb5864ae608) @@ -419,6 +419,18 @@ } /// + /// Looks up a localized string similar to Als u de doelkans aanpast, dan worden alle bijbehorende rekenresultaten verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler_Confirm_change_target_probability_and_clear_dependent_data { + get { + return ResourceManager.GetString("HydraulicBoundaryLocationCalculationsForTargetProbabilityChangeHandler_Confirm_ch" + + "ange_target_probability_and_clear_dependent_data", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Importeren van het HLCD bestand. /// public static string HydraulicLocationConfigurationDatabaseImportHandler_ImportHydraulicLocationConfigurationSettings_Description { Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u -r119d7f9ec28459422a25a3aa96034cb7c7c303ac -r7e097df29e12ff33d862f07ca7ec9cb5864ae608 --- Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 119d7f9ec28459422a25a3aa96034cb7c7c303ac) +++ Riskeer/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 7e097df29e12ff33d862f07ca7ec9cb5864ae608) @@ -271,4 +271,9 @@ Voeg een nieuwe doelkans toe aan deze map met golfhoogten. + + Als u de doelkans aanpast, dan worden alle bijbehorende rekenresultaten verwijderd. + +Weet u zeker dat u wilt doorgaan? + \ No newline at end of file