Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -r07b0e83704b56684d617cd6e8b8570417654912a -r0c05978e0502e47090bffa6f5716c91dae3e7150 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 07b0e83704b56684d617cd6e8b8570417654912a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 0c05978e0502e47090bffa6f5716c91dae3e7150) @@ -45,6 +45,7 @@ private DataGridViewComboBoxColumn soilProfileColumn; private DataGridViewComboBoxColumn hydraulicBoundaryLocationColumn; private readonly RecursiveObserver pipingCalculationGroupObserver; + private readonly Observer pipingSoilProfilesObserver; /// /// Creates a new instance of the class. @@ -55,6 +56,7 @@ InitializeDataGridView(); pipingCalculationGroupObserver = new RecursiveObserver(UpdateDataGridViewDataSource, pg => pg.Children.OfType()); + pipingSoilProfilesObserver = new Observer(UpdateSoilProfileColumn); } /// @@ -70,9 +72,9 @@ { pipingFailureMechanism = value; - var pipingSoilProfiles = pipingFailureMechanism != null ? pipingFailureMechanism.SoilProfiles : null; + pipingSoilProfilesObserver.Observable = pipingFailureMechanism != null ? pipingFailureMechanism.SoilProfiles : null; - soilProfileColumn.DataSource = GetSoilProfilesDataSource(pipingSoilProfiles); + UpdateSoilProfileColumn(); } } @@ -120,6 +122,19 @@ } } + protected override void Dispose(bool disposing) + { + AssessmentSection = null; + PipingFailureMechanism = null; + + if (disposing && (components != null)) + { + components.Dispose(); + } + + base.Dispose(disposing); + } + private void InitializeDataGridView() { var nameColumn = new DataGridViewTextBoxColumn @@ -195,6 +210,13 @@ .ToList(); } + private void UpdateSoilProfileColumn() + { + var pipingSoilProfiles = pipingFailureMechanism != null ? pipingFailureMechanism.SoilProfiles : null; + + soilProfileColumn.DataSource = GetSoilProfilesDataSource(pipingSoilProfiles); + } + private static List> GetSoilProfilesDataSource(IEnumerable soilProfiles = null) { var dataGridViewComboBoxItemWrappers = new List>