Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs
===================================================================
diff -u -rd379e2613c8c2cc7ac233c239e6fd16b4d4d07be -r9f613c61f6adfeeee7d18bb011c5b8a13f3caeb0
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision d379e2613c8c2cc7ac233c239e6fd16b4d4d07be)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision 9f613c61f6adfeeee7d18bb011c5b8a13f3caeb0)
@@ -30,21 +30,7 @@
/// Required designer variable.
///
private IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
+
#region Component Designer generated code
///
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs
===================================================================
diff -u -rd5e6ce84ede6a47f1c90052b1a9f55aedb5e2359 -r9f613c61f6adfeeee7d18bb011c5b8a13f3caeb0
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision d5e6ce84ede6a47f1c90052b1a9f55aedb5e2359)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision 9f613c61f6adfeeee7d18bb011c5b8a13f3caeb0)
@@ -18,11 +18,22 @@
// 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 Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
using Core.Common.Controls.Views;
+using Core.Common.Util.Extensions;
+using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
+using Riskeer.Common.Data.FailureMechanism;
using Riskeer.MacroStabilityInwards.Data;
+using Riskeer.MacroStabilityInwards.Forms.PresentationObjects;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
namespace Riskeer.MacroStabilityInwards.Forms.Views
{
@@ -31,6 +42,22 @@
///
public partial class MacroStabilityInwardsScenariosView : UserControl, IView
{
+ private readonly MacroStabilityInwardsFailureMechanism failureMechanism;
+ private readonly IAssessmentSection assessmentSection;
+ private CalculationGroup calculationGroup;
+
+ private Observer failureMechanismObserver;
+
+ private RecursiveObserver, MacroStabilityInwardsScenarioConfigurationPerFailureMechanismSection>
+ scenarioConfigurationsPerFailureMechanismSectionObserver;
+
+ private RecursiveObserver calculationGroupObserver;
+ private RecursiveObserver calculationObserver;
+ private RecursiveObserver calculationInputObserver;
+
+ private IEnumerable scenarioRows;
+ private MacroStabilityInwardsScenarioViewFailureMechanismSectionViewModel selectedFailureMechanismSection;
+
///
/// Creates a new instance of .
///
@@ -51,9 +78,212 @@
throw new ArgumentNullException(nameof(failureMechanism));
}
+ this.calculationGroup = calculationGroup;
+ this.failureMechanism = failureMechanism;
+
+ InitializeObservers();
+
InitializeComponent();
+
+ InitializeListBox();
+ InitializeDataGridView();
+
+ UpdateSectionsListBox();
+ UpdateScenarioControls();
}
- public object Data { get; set; }
+ public object Data
+ {
+ get => calculationGroup;
+ set => calculationGroup = (CalculationGroup) value;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ failureMechanismObserver.Dispose();
+ scenarioConfigurationsPerFailureMechanismSectionObserver.Dispose();
+ calculationGroupObserver.Dispose();
+ calculationObserver.Dispose();
+ calculationInputObserver.Dispose();
+
+ if (disposing)
+ {
+ components?.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void InitializeObservers()
+ {
+ failureMechanismObserver = new Observer(() =>
+ {
+ UpdateSectionsListBox();
+ // UpdateLengthEffectControls();
+ // UpdateLengthEffectData();
+ })
+ {
+ Observable = failureMechanism
+ };
+
+ scenarioConfigurationsPerFailureMechanismSectionObserver = new RecursiveObserver, MacroStabilityInwardsScenarioConfigurationPerFailureMechanismSection>(
+ UpdateSectionsListBox, section => section)
+ {
+ Observable = failureMechanism.ScenarioConfigurationsPerFailureMechanismSection
+ };
+
+ calculationGroupObserver = new RecursiveObserver(UpdateScenarioControls, pcg => pcg.Children)
+ {
+ Observable = calculationGroup
+ };
+
+ calculationObserver = new RecursiveObserver(() =>
+ {
+ UpdateScenarioRows();
+ UpdateTotalScenarioContributionLabel();
+ }, pcg => pcg.Children)
+ {
+ Observable = calculationGroup
+ };
+
+ // The concat is needed to observe the input of calculations in child groups.
+ calculationInputObserver = new RecursiveObserver(
+ UpdateScenarioControls, pcg => pcg.Children.Concat