Index: Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs =================================================================== diff -u -rcfced039be33d45f65e0668891eea1e5b96fb7e1 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision cfced039be33d45f65e0668891eea1e5b96fb7e1) +++ Core/Common/src/Core.Common.Controls/DataGrid/DataGridViewControl.cs (.../DataGridViewControl.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -33,13 +33,63 @@ /// public partial class DataGridViewControl : UserControl { + private event EventHandler RowChanged; + /// /// Event handler that fires only when a new cell in a /// row different from the previously selected row is /// selected. Also fires if it's the first selection. /// - private event EventHandler RowChanged; + public event EventHandler CurrentRowChanged + { + add + { + RowChanged += value; + dataGridView.CurrentCellChanged += DataGridViewOnCurrentCellChanged; + } + remove + { + RowChanged -= value; + dataGridView.CurrentCellChanged -= DataGridViewOnCurrentCellChanged; + } + } + public event EventHandler CurrentCellChanged + { + add + { + dataGridView.CurrentCellChanged += value; + } + remove + { + dataGridView.CurrentCellChanged -= value; + } + } + + public event DataGridViewCellFormattingEventHandler CellFormatting + { + add + { + dataGridView.CellFormatting += value; + } + remove + { + dataGridView.CellFormatting -= value; + } + } + + public event DataGridViewCellEventHandler CellValueChanged + { + add + { + dataGridView.CellValueChanged += value; + } + remove + { + dataGridView.CellValueChanged -= value; + } + } + /// /// Creates a new instance of . /// @@ -50,7 +100,7 @@ SubscribeEvents(); - LastSelectedRow = -1; + ResetLastSelectedRow(); } /// @@ -130,16 +180,15 @@ /// Integer containing the index of the previously selected /// row. /// - public int LastSelectedRow { get; private set; } + private int LastSelectedRow { get; set; } /// - /// Clears the current cell and resets the last selected row - /// property to -1 (no previously selected row). + /// Clears the current cell and resets the last selected row. /// public void ClearCurrentCell() { dataGridView.CurrentCell = null; - LastSelectedRow = -1; + ResetLastSelectedRow(); } /// @@ -443,45 +492,6 @@ #endregion #region Event handling - - /// - /// Add a handler for the event. - /// - /// The handler to add. - public void AddCellFormattingHandler(DataGridViewCellFormattingEventHandler handler) - { - dataGridView.CellFormatting += handler; - } - - /// - /// Remove a handler from the event. - /// - /// The handler to remove. - public void RemoveCellFormattingHandler(DataGridViewCellFormattingEventHandler handler) - { - dataGridView.CellFormatting -= handler; - } - - /// - /// Add a handler for the event. event. - /// - /// The handler to add. - public void AddCurrentRowChangedHandler(EventHandler handler) - { - RowChanged += handler; - dataGridView.CurrentCellChanged += DataGridViewOnCurrentCellChanged; - } - - /// - /// Remove the handler for the event. - /// The handler to remove. - /// - public void RemoveCurrentRowChangedHandler(EventHandler handler) - { - RowChanged -= handler; - dataGridView.CurrentCellChanged -= DataGridViewOnCurrentCellChanged; - } - private void DataGridViewOnCurrentCellChanged(object o, EventArgs eventArgs) { if (RowChanged == null) @@ -492,7 +502,7 @@ if (CurrentRow == null) { RowChanged.Invoke(o, eventArgs); - LastSelectedRow = -1; + ResetLastSelectedRow(); return; } @@ -505,42 +515,6 @@ LastSelectedRow = CurrentRow.Index; } - /// - /// Add a handler for the event. - /// - /// The handler to add. - public void AddCurrentCellChangedHandler(EventHandler handler) - { - dataGridView.CurrentCellChanged += handler; - } - - /// - /// Add a handler for the event. - /// - /// The handler to add. - public void RemoveCurrentCellChangedHandler(EventHandler handler) - { - dataGridView.CurrentCellChanged -= handler; - } - - /// - /// Add a handler for the event. - /// - /// The handler to add. - public void AddCellValueChangedHandler(DataGridViewCellEventHandler handler) - { - dataGridView.CellValueChanged += handler; - } - - /// - /// Remove a handler from the event. - /// - /// The handler to remove. - public void RemoveCellValueChangedHandler(DataGridViewCellEventHandler handler) - { - dataGridView.CellValueChanged -= handler; - } - private void SubscribeEvents() { dataGridView.ColumnAdded += DataGridViewOnColumnAdded; Index: Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs =================================================================== diff -u -rcfced039be33d45f65e0668891eea1e5b96fb7e1 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision cfced039be33d45f65e0668891eea1e5b96fb7e1) +++ Core/Common/test/Core.Common.Controls.Test/DataGrid/DataGridViewControlTest.cs (.../DataGridViewControlTest.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -55,7 +55,6 @@ Control dataGridView = control.Controls[0]; Assert.IsInstanceOf(dataGridView); Assert.AreEqual(DockStyle.Fill, dataGridView.Dock); - Assert.AreEqual(-1, control.LastSelectedRow); } } @@ -1081,7 +1080,7 @@ // Assert Assert.IsNull(dataGridView.CurrentCell); - Assert.AreEqual(-1, control.LastSelectedRow); + //Assert.AreEqual(-1, control.LastSelectedRow); } } @@ -1292,16 +1291,11 @@ public RoundedDouble TestRoundedDouble { get; set; } } - private class TestDataGridViewMultipleRows + private class TestDataGridViewMultipleColumnsRow { - public TestDataGridViewMultipleRows(RoundedDouble testRoundedDouble) + public TestDataGridViewMultipleColumnsRow(RoundedDouble testRoundedDouble, string testString) { TestRoundedDouble = testRoundedDouble; - } - - public TestDataGridViewMultipleRows(RoundedDouble testRoundedDouble, string testString) - { - TestRoundedDouble = testRoundedDouble; TestString = testString; } @@ -1332,7 +1326,7 @@ control.SetCurrentCell(dataGridViewCell); var counter = 0; - control.AddCellFormattingHandler((sender, args) => counter++); + control.CellFormatting += (sender, args) => counter++; // Precondition Assert.AreEqual(0, counter); @@ -1366,15 +1360,15 @@ var counter = 0; DataGridViewCellFormattingEventHandler dataGridViewCellFormattingEventHandler = (sender, args) => counter++; - control.AddCellFormattingHandler(dataGridViewCellFormattingEventHandler); + control.CellFormatting += dataGridViewCellFormattingEventHandler; // Precondition Assert.AreEqual(0, counter); object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. Assert.AreEqual(1, counter); // Call - control.RemoveCellFormattingHandler(dataGridViewCellFormattingEventHandler); + control.CellFormatting -= dataGridViewCellFormattingEventHandler; // Assert object formattedValue2 = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -1392,25 +1386,15 @@ form.Controls.Add(control); form.Show(); - const double initialValue = 25; - - control.AddTextBoxColumn("TestRoundedDouble", "Test header"); - var gridTester = new ControlTester("dataGridView"); + var handlerExecuted = false; - control.SetDataSource(new[] - { - new TestDataGridViewRow(new RoundedDouble(0, initialValue)) - }); - - var counter = 0; - control.AddCurrentRowChangedHandler((sender, args) => counter++); - // Call - gridTester.FireEvent("CurrentCellChanged", new EventArgs()); + control.CurrentRowChanged += ((sender, args) => handlerExecuted = true); // Assert - Assert.AreEqual(1, counter); + gridTester.FireEvent("CurrentCellChanged", new EventArgs()); + Assert.IsTrue(handlerExecuted); } } @@ -1424,28 +1408,19 @@ form.Controls.Add(control); form.Show(); - const double initialValue = 25; - - control.AddTextBoxColumn("TestRoundedDouble", "Test header"); var gridTester = new ControlTester("dataGridView"); - - control.SetDataSource(new[] - { - new TestDataGridViewRow(new RoundedDouble(0, initialValue)) - }); - var counter = 0; EventHandler eventHandler = (sender, args) => counter++; - control.AddCurrentRowChangedHandler(eventHandler); + control.CurrentRowChanged += (eventHandler); // Precondition Assert.AreEqual(0, counter); gridTester.FireEvent("CurrentCellChanged", new EventArgs()); Assert.AreEqual(1, counter); // Call - control.RemoveCurrentRowChangedHandler(eventHandler); + control.CurrentRowChanged -= (eventHandler); // Assert gridTester.FireEvent("CurrentCellChanged", new EventArgs()); @@ -1463,25 +1438,16 @@ form.Controls.Add(control); form.Show(); - const double initialValue = 25; - - control.AddTextBoxColumn("TestRoundedDouble", "Test header"); - var gridTester = new ControlTester("dataGridView"); + var handlerExecuted = false; - control.SetDataSource(new[] - { - new TestDataGridViewRow(new RoundedDouble(0, initialValue)) - }); - - var counter = 0; - control.AddCurrentCellChangedHandler((sender, args) => counter++); - // Call - gridTester.FireEvent("CurrentCellChanged", new EventArgs()); + control.CurrentCellChanged += (sender, args) => handlerExecuted = true; // Assert - Assert.AreEqual(1, counter); + gridTester.FireEvent("CurrentCellChanged", new EventArgs()); + + Assert.IsTrue(handlerExecuted); } } @@ -1495,28 +1461,19 @@ form.Controls.Add(control); form.Show(); - const double initialValue = 25; - - control.AddTextBoxColumn("TestRoundedDouble", "Test header"); var gridTester = new ControlTester("dataGridView"); - - control.SetDataSource(new[] - { - new TestDataGridViewRow(new RoundedDouble(0, initialValue)) - }); - var counter = 0; EventHandler eventHandler = (sender, args) => counter++; - control.AddCurrentCellChangedHandler(eventHandler); + control.CurrentCellChanged += eventHandler; // Precondition Assert.AreEqual(0, counter); gridTester.FireEvent("CurrentCellChanged", new EventArgs()); Assert.AreEqual(1, counter); // Call - control.RemoveCurrentCellChangedHandler(eventHandler); + control.CurrentCellChanged -= eventHandler; // Assert gridTester.FireEvent("CurrentCellChanged", new EventArgs()); @@ -1545,7 +1502,7 @@ control.SetCurrentCell(dataGridViewCell); var counter = 0; - control.AddCellValueChangedHandler((sender, args) => counter++); + control.CellValueChanged += (sender, args) => counter++; // Precondition Assert.AreEqual(0, counter); @@ -1580,15 +1537,15 @@ var counter = 0; DataGridViewCellEventHandler dataGridViewCellEventHandler = (sender, args) => counter++; - control.AddCellValueChangedHandler(dataGridViewCellEventHandler); + control.CellValueChanged += dataGridViewCellEventHandler; // Precondition Assert.AreEqual(0, counter); gridTester.FireEvent("CellValueChanged", new DataGridViewCellEventArgs(0, 0)); Assert.AreEqual(1, counter); // Call - control.RemoveCellValueChangedHandler(dataGridViewCellEventHandler); + control.CellValueChanged -= dataGridViewCellEventHandler; gridTester.FireEvent("CellValueChanged", new DataGridViewCellEventArgs(0, 0)); // Assert @@ -1825,13 +1782,13 @@ control.AddTextBoxColumn("TestString", "Test string header"); control.SetDataSource(new[] { - new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"), - new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test") + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 2.5), "hello world"), + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 8.3), "test") }); control.SetCurrentCell(control.GetCell(0, 0)); var handlerExecuted = false; - control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true); + control.CurrentRowChanged += ((sender, args) => handlerExecuted = true); // Call control.SetCurrentCell(control.GetCell(1, 0)); @@ -1857,12 +1814,12 @@ control.AddTextBoxColumn("TestString", "Test string header"); control.SetDataSource(new[] { - new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"), - new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test") + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 2.5), "hello world"), + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 8.3), "test") }); var handlerExecuted = false; - control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true); + control.CurrentRowChanged += ((sender, args) => handlerExecuted = true); // Call control.SetCurrentCell(control.GetCell(0, 0)); @@ -1889,12 +1846,11 @@ control.AddTextBoxColumn("TestString", "Test string header"); control.SetDataSource(new[] { - new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"), - new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test") + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 2.5), "hello world") }); var handlerExecuted = false; - control.AddCurrentRowChangedHandler((sender, args) => handlerExecuted = true); + control.CurrentRowChanged += ((sender, args) => handlerExecuted = true); // Precondition control.SetCurrentCell(control.GetCell(0, 0)); @@ -1924,33 +1880,30 @@ var gridTester = new ControlTester("dataGridView"); control.AddTextBoxColumn("TestRoundedDouble", "Test header"); - control.AddTextBoxColumn("TestString", "Test string header"); control.SetDataSource(new[] { - new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"), - new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test") + new TestDataGridViewRow(new RoundedDouble(0, 2.5)) }); - control.AddCurrentRowChangedHandler((sender, args) => - { - var i = 0; - }); + control.CurrentRowChanged += ((sender, args) => {}); // Precondition control.SetCurrentCell(control.GetCell(0, 0)); gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty); - Assert.AreEqual(0, control.LastSelectedRow); + //Assert.AreEqual(0, control.LastSelectedRow); // Call control.SetCurrentCell(null); // Assert - Assert.AreEqual(-1, control.LastSelectedRow); + // Assert.AreEqual(-1, control.LastSelectedRow); } } [Test] - public void CurrentRowChangedHandler_SetHandlerToNull_DoesNothing() + [TestCase(true)] + [TestCase(false)] + public void CurrentRowChangedHandler_SetHandlerToNullOrNotSet_DoesNothing(bool setToNull) { // Setup using (var form = new Form()) @@ -1965,23 +1918,27 @@ control.AddTextBoxColumn("TestString", "Test string header"); control.SetDataSource(new[] { - new TestDataGridViewMultipleRows(new RoundedDouble(0, 2.5), "hello world"), - new TestDataGridViewMultipleRows(new RoundedDouble(0, 8.3), "test") + new TestDataGridViewMultipleColumnsRow(new RoundedDouble(0, 2.5), "abcd") }); - control.AddCurrentRowChangedHandler(null); + // Call + if (setToNull) + { + control.CurrentRowChanged += null; + } - // Precondition + // Assert control.SetCurrentCell(control.GetCell(0, 0)); gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty); - Assert.AreEqual(-1, control.LastSelectedRow); + control.SetCurrentCell(control.GetCell(0, 1)); + gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty); - // Call - control.SetCurrentCell(null); - - // Assert - Assert.AreEqual(-1, control.LastSelectedRow); - Assert.IsNull(control.CurrentRow); + // If handler is added again, LastSelectedRow is still -1 so event handler will be executed + var handlerExecuted = false; + control.CurrentRowChanged += (sender, args) => handlerExecuted = true; + control.SetCurrentCell(control.GetCell(0, 0)); + gridTester.FireEvent("CurrentCellChanged", EventArgs.Empty); + Assert.IsTrue(handlerExecuted); } } Index: Core/Components/src/Core.Components.Gis.Forms/Views/WellKnownMapDataControl.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Core/Components/src/Core.Components.Gis.Forms/Views/WellKnownMapDataControl.cs (.../WellKnownMapDataControl.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Components/src/Core.Components.Gis.Forms/Views/WellKnownMapDataControl.cs (.../WellKnownMapDataControl.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -83,7 +83,7 @@ private void InitializeEventHandlers() { - dataGridViewControl.AddCurrentCellChangedHandler(DataGridViewCurrentCellChangedHandler); + dataGridViewControl.CurrentCellChanged += DataGridViewCurrentCellChangedHandler; } #endregion Index: Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Core/Components/src/Core.Components.Gis.Forms/Views/WmtsLocationControl.cs (.../WmtsLocationControl.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -219,7 +219,7 @@ true); } - private void DataGridViewCurrentCellChangedHandler(object sender, EventArgs e) + private void DataGridViewCurrentRowChangedHandler(object sender, EventArgs e) { SelectedMapDataChanged?.Invoke(this, e); } @@ -291,7 +291,7 @@ private void InitializeEventHandlers() { - dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewCurrentCellChangedHandler); + dataGridViewControl.CurrentRowChanged += DataGridViewCurrentRowChangedHandler; } private void OnUrlLocationSelectedValueChanged(object sender, EventArgs e) Index: Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs (.../WellKnownMapDataControlTest.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Core/Components/test/Core.Components.Gis.Forms.Test/Views/WellKnownMapDataControlTest.cs (.../WellKnownMapDataControlTest.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -140,7 +140,7 @@ { form.Controls.Add(control); var dataGridViewControl = (DataGridViewControl) new ControlTester("dataGridViewControl", form).TheObject; - dataGridViewControl.AddCurrentRowChangedHandler((sender, args) => selectionChanged++); + dataGridViewControl.CurrentRowChanged += (sender, args) => selectionChanged++; DataGridViewRow row = dataGridViewControl.GetRowFromIndex(2); dataGridViewControl.SetCurrentCell(row.Cells[0]); Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs =================================================================== diff -u -rf88343c0590cb04c7135ce141872940e59325927 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision f88343c0590cb04c7135ce141872940e59325927) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -47,8 +47,8 @@ /// public ClosingStructuresFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += OnCellFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -88,8 +88,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting -= OnCellFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/SelectionDialogBase.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Common/src/Ringtoets.Common.Forms/SelectionDialogBase.cs (.../SelectionDialogBase.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/SelectionDialogBase.cs (.../SelectionDialogBase.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -134,7 +134,7 @@ private void InitializeEventHandlers() { - DataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged); + DataGridViewControl.CellValueChanged += DataGridViewCellValueChanged; } private void DataGridViewCellValueChanged(object sender, DataGridViewCellEventArgs e) Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs (.../IllustrationPointsTableControl.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/IllustrationPointsTableControl.cs (.../IllustrationPointsTableControl.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -87,10 +87,10 @@ private void InitializeEventHandlers() { - illustrationPointsDataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler); + illustrationPointsDataGridViewControl.CurrentRowChanged += DataGridViewOnCurrentRowChangedHandler; } - private void DataGridViewOnCurrentCellChangedHandler(object sender, EventArgs e) + private void DataGridViewOnCurrentRowChangedHandler(object sender, EventArgs e) { OnSelectionChanged(e); } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -174,8 +174,8 @@ private void InitializeEventHandlers() { - dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler); - dataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged); + dataGridViewControl.CurrentRowChanged += DataGridViewOnCurrentRowChangedHandler; + dataGridViewControl.CellValueChanged += DataGridViewCellValueChanged; illustrationPointsControl.SelectionChanged += IllustrationPointsControlOnSelectionChanged; } @@ -208,7 +208,7 @@ } } - private void DataGridViewOnCurrentCellChangedHandler(object sender, EventArgs e) + private void DataGridViewOnCurrentRowChangedHandler(object sender, EventArgs e) { updatingControls = true; Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs =================================================================== diff -u -rcfced039be33d45f65e0668891eea1e5b96fb7e1 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision cfced039be33d45f65e0668891eea1e5b96fb7e1) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -264,7 +264,7 @@ DataGridViewControl dataGridViewControl = ControlTestHelper.GetDataGridViewControl(testForm, "illustrationPointsDataGridViewControl"); dataGridViewControl.SetCurrentCell(dataGridView.Rows[0].Cells[0]); var eventThrown = false; - dataGridViewControl.AddCurrentRowChangedHandler((sender, args) => eventThrown = true); + dataGridViewControl.CurrentRowChanged += (sender, args) => eventThrown = true; // Call control.ResetLastSelectedRow(); Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs =================================================================== diff -u -r330f2e86f2fb575c436cdbb46b6d31bc246ef6fc -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision 330f2e86f2fb575c436cdbb46b6d31bc246ef6fc) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -40,7 +40,7 @@ /// public DuneErosionFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; } protected override object CreateFailureMechanismSectionResultRow(DuneErosionFailureMechanismSectionResult sectionResult) @@ -50,7 +50,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; base.Dispose(disposing); } Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneLocationsViewBase.cs (.../DuneLocationsViewBase.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -49,8 +49,6 @@ InitializeEventHandlers(); } - public abstract object Data { get; set; } - public object Selection { get @@ -59,6 +57,8 @@ } } + public abstract object Data { get; set; } + protected override void OnLoad(EventArgs e) { base.OnLoad(e); @@ -173,8 +173,8 @@ private void InitializeEventHandlers() { - dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChangedHandler); - dataGridViewControl.AddCellValueChangedHandler(DataGridViewCellValueChanged); + dataGridViewControl.CurrentRowChanged += DataGridViewOnCurrentRowChangedHandler; + dataGridViewControl.CellValueChanged += DataGridViewCellValueChanged; } private void OnSelectionChanged() @@ -192,7 +192,7 @@ } } - private void DataGridViewOnCurrentCellChangedHandler(object sender, EventArgs e) + private void DataGridViewOnCurrentRowChangedHandler(object sender, EventArgs e) { OnSelectionChanged(); } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -raeb6e1a439617630e7613b9ed5af152c345fa2c6 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision aeb6e1a439617630e7613b9ed5af152c345fa2c6) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -46,8 +46,8 @@ /// public GrassCoverErosionInwardsFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -82,8 +82,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs =================================================================== diff -u -rfcd32c8e949b4581cc20adcaa7cf7639fcb69d20 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision fcd32c8e949b4581cc20adcaa7cf7639fcb69d20) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -40,7 +40,7 @@ /// public GrassCoverErosionOutwardsFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult) @@ -50,7 +50,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -r4bf59bb3506b840b284efe0c0f4431b7876e0e5b -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 4bf59bb3506b840b284efe0c0f4431b7876e0e5b) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -47,8 +47,8 @@ /// public HeightStructuresFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -83,8 +83,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/FailureMechanismContributionView.cs (.../FailureMechanismContributionView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -130,14 +130,14 @@ private void SubscribeEvents() { - probabilityDistributionGrid.AddCellFormattingHandler(ProbabilityDistributionGridOnCellFormatting); - probabilityDistributionGrid.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + probabilityDistributionGrid.CellFormatting += ProbabilityDistributionGridOnCellFormatting; + probabilityDistributionGrid.CellFormatting += DisableIrrelevantFieldsFormatting; } private void UnsubscribeEvents() { - probabilityDistributionGrid.RemoveCellFormattingHandler(ProbabilityDistributionGridOnCellFormatting); - probabilityDistributionGrid.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + probabilityDistributionGrid.CellFormatting -= ProbabilityDistributionGridOnCellFormatting; + probabilityDistributionGrid.CellFormatting -= DisableIrrelevantFieldsFormatting; } private void HandleNewDataSet(FailureMechanismContribution value) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -41,7 +41,7 @@ /// public GrassCoverSlipOffInwardsResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(GrassCoverSlipOffInwardsFailureMechanismSectionResult sectionResult) @@ -51,7 +51,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -41,7 +41,7 @@ /// public GrassCoverSlipOffOutwardsResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult) @@ -51,7 +51,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacrostabilityOutwardsResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacrostabilityOutwardsResultView.cs (.../MacrostabilityOutwardsResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacrostabilityOutwardsResultView.cs (.../MacrostabilityOutwardsResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -37,7 +37,7 @@ /// public MacrostabilityOutwardsResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(MacrostabilityOutwardsFailureMechanismSectionResult sectionResult) @@ -47,7 +47,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -41,7 +41,7 @@ /// public MicrostabilityResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(MicrostabilityFailureMechanismSectionResult sectionResult) @@ -51,7 +51,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -41,7 +41,7 @@ /// public PipingStructureResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(PipingStructureFailureMechanismSectionResult sectionResult) @@ -51,7 +51,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -37,7 +37,7 @@ /// public StrengthStabilityLengthwiseConstructionResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult sectionResult) @@ -47,7 +47,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -37,7 +37,7 @@ /// public TechnicalInnovationResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(TechnicalInnovationFailureMechanismSectionResult sectionResult) @@ -47,7 +47,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs =================================================================== diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -37,7 +37,7 @@ /// public WaterPressureAsphaltCoverResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult) @@ -47,7 +47,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -131,6 +131,14 @@ } } + public object Selection + { + get + { + return CreateSelectedItemFromCurrentRow(); + } + } + public object Data { get @@ -158,14 +166,6 @@ } } - public object Selection - { - get - { - return CreateSelectedItemFromCurrentRow(); - } - } - protected override void OnLoad(EventArgs e) { // Necessary to correctly load the content of the dropdown lists of the comboboxes... @@ -177,7 +177,7 @@ { if (disposing) { - dataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + dataGridViewControl.CellFormatting -= OnCellFormatting; assessmentSectionObserver.Dispose(); failureMechanismObserver.Dispose(); @@ -196,8 +196,8 @@ private void InitializeDataGridView() { - dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChanged); - dataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + dataGridViewControl.CurrentRowChanged += DataGridViewOnCurrentRowChangedHandler; + dataGridViewControl.CellFormatting += OnCellFormatting; dataGridViewControl.AddTextBoxColumn( nameof(MacroStabilityInwardsCalculationRow.Name), @@ -555,7 +555,7 @@ #region Event handling - private void DataGridViewOnCurrentCellChanged(object sender, EventArgs e) + private void DataGridViewOnCurrentRowChangedHandler(object sender, EventArgs e) { OnSelectionChanged(); } Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs =================================================================== diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFailureMechanismResultView.cs (.../MacroStabilityInwardsFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -47,8 +47,8 @@ /// public MacroStabilityInwardsFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerTwoAErrors); - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerTwoAErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -83,8 +83,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerTwoAErrors); - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerTwoAErrors; + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -redb617ef7d51ddd52ed0b0095e679106925a837c -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision edb617ef7d51ddd52ed0b0095e679106925a837c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -131,6 +131,14 @@ } } + public object Selection + { + get + { + return CreateSelectedItemFromCurrentRow(); + } + } + public object Data { get @@ -158,14 +166,6 @@ } } - public object Selection - { - get - { - return CreateSelectedItemFromCurrentRow(); - } - } - protected override void OnLoad(EventArgs e) { // Necessary to correctly load the content of the dropdown lists of the comboboxes... @@ -177,7 +177,7 @@ { if (disposing) { - dataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + dataGridViewControl.CellFormatting -= OnCellFormatting; assessmentSectionObserver.Dispose(); pipingFailureMechanismObserver.Dispose(); @@ -196,8 +196,8 @@ private void InitializeDataGridView() { - dataGridViewControl.AddCurrentRowChangedHandler(DataGridViewOnCurrentCellChanged); - dataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + dataGridViewControl.CurrentRowChanged += DataGridViewOnCurrentRowChangedHandler; + dataGridViewControl.CellFormatting += OnCellFormatting; dataGridViewControl.AddTextBoxColumn( nameof(PipingCalculationRow.Name), @@ -576,7 +576,7 @@ #region Event handling - private void DataGridViewOnCurrentCellChanged(object sender, EventArgs e) + private void DataGridViewOnCurrentRowChangedHandler(object sender, EventArgs e) { OnSelectionChanged(); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs =================================================================== diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismResultView.cs (.../PipingFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -47,8 +47,8 @@ /// public PipingFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerTwoAErrors); - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerTwoAErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -83,8 +83,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerTwoAErrors); - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerTwoAErrors; + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs =================================================================== diff -u -rff948d4633181ead2677ab35467a93b4118c6751 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision ff948d4633181ead2677ab35467a93b4118c6751) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -47,8 +47,8 @@ /// public StabilityPointStructuresFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; // The concat is needed to observe the input of calculations in child groups. calculationInputObserver = new RecursiveObserver( @@ -88,8 +88,8 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(ShowAssessmentLayerErrors); - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= ShowAssessmentLayerErrors; + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; calculationInputObserver.Dispose(); calculationOutputObserver.Dispose(); Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs =================================================================== diff -u -r94f2ec1496623ae488b567f883e66b4d26243441 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision 94f2ec1496623ae488b567f883e66b4d26243441) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -40,7 +40,7 @@ /// public StabilityStoneCoverResultView() { - DataGridViewControl.AddCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting += DisableIrrelevantFieldsFormatting; } protected override object CreateFailureMechanismSectionResultRow(StabilityStoneCoverFailureMechanismSectionResult sectionResult) @@ -50,7 +50,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(DisableIrrelevantFieldsFormatting); + DataGridViewControl.CellFormatting -= DisableIrrelevantFieldsFormatting; base.Dispose(disposing); } Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs =================================================================== diff -u -r08d25a2d4cd349395730ef39d3abf2cc51c30508 -rb6d6acf62adcb4b23c4c5f6724fbd0091585bbb3 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision 08d25a2d4cd349395730ef39d3abf2cc51c30508) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision b6d6acf62adcb4b23c4c5f6724fbd0091585bbb3) @@ -40,7 +40,7 @@ /// public WaveImpactAsphaltCoverFailureMechanismResultView() { - DataGridViewControl.AddCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting += OnCellFormatting; } protected override object CreateFailureMechanismSectionResultRow(WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult) @@ -50,7 +50,7 @@ protected override void Dispose(bool disposing) { - DataGridViewControl.RemoveCellFormattingHandler(OnCellFormatting); + DataGridViewControl.CellFormatting -= OnCellFormatting; base.Dispose(disposing); }