Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs =================================================================== diff -u -r469c1810a2cc836791b78d185c7c1b0d414ec472 -r44021b29f3cdb11c11b22ca2b45e637b7ef20253 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs (.../AssessmentSectionMergeDataProviderDialog.cs) (revision 469c1810a2cc836791b78d185c7c1b0d414ec472) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs (.../AssessmentSectionMergeDataProviderDialog.cs) (revision 44021b29f3cdb11c11b22ca2b45e637b7ef20253) @@ -42,9 +42,6 @@ { private FailureMechanismMergeDataRow[] failureMechanismMergeDataRows; private bool assessmentSectionComboBoxUpdating; - private bool isDataSelected; - private AssessmentSection selectedAssessmentSection; - private IEnumerable selectedFailureMechanisms; /// /// Creates a new instance of the . @@ -68,10 +65,12 @@ } SetComboBoxData(assessmentSections); - ShowDialog(); - return isDataSelected - ? new AssessmentSectionMergeData(selectedAssessmentSection, selectedFailureMechanisms) + return ShowDialog() == DialogResult.OK + ? new AssessmentSectionMergeData((AssessmentSection) assessmentSectionComboBox.SelectedItem, + failureMechanismMergeDataRows.Where(row => row.IsSelected) + .Select(row => row.FailureMechanism) + .ToArray()) : null; } @@ -84,7 +83,6 @@ base.Dispose(disposing); - importButton.Click -= OnImportButtonClick; assessmentSectionComboBox.SelectedIndexChanged -= AssessmentSectionComboBox_OnSelectedIndexChanged; } @@ -117,6 +115,20 @@ toolTip.SetToolTip(infoIcon, Resources.AssessmentSectionMergeDataProviderDialog_InfoToolTip); } + #region Event Handling + + private void AssessmentSectionComboBox_OnSelectedIndexChanged(object sender, EventArgs eventArgs) + { + if (assessmentSectionComboBoxUpdating || assessmentSectionComboBox.SelectedIndex == -1) + { + return; + } + + SetDataGridViewData((AssessmentSection) assessmentSectionComboBox.SelectedItem); + } + + #endregion + #region Data Setters private void SetComboBoxData(IEnumerable assessmentSections) @@ -162,30 +174,5 @@ } #endregion - - #region Event Handling - - private void AssessmentSectionComboBox_OnSelectedIndexChanged(object sender, EventArgs eventArgs) - { - if (assessmentSectionComboBoxUpdating || assessmentSectionComboBox.SelectedIndex == -1) - { - return; - } - - SetDataGridViewData((AssessmentSection) assessmentSectionComboBox.SelectedItem); - } - - private void OnImportButtonClick(object sender, EventArgs eventArgs) - { - selectedAssessmentSection = (AssessmentSection) assessmentSectionComboBox.SelectedItem; - selectedFailureMechanisms = failureMechanismMergeDataRows?.Where(row => row.IsSelected) - .Select(row => row.FailureMechanism) - .ToArray(); - - isDataSelected = true; - Close(); - } - - #endregion } } \ No newline at end of file