Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs =================================================================== diff -u -r50b3a6c556aace513b84909963bbc0ad37ee4374 -rb0dc46315e824778c8f43d8956f958376a3b802f --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision 50b3a6c556aace513b84909963bbc0ad37ee4374) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/FailureMechanismResultView.cs (.../FailureMechanismResultView.cs) (revision b0dc46315e824778c8f43d8956f958376a3b802f) @@ -27,6 +27,7 @@ using Core.Common.Controls.DataGrid; using Core.Common.Controls.Views; using Core.Common.Util.Extensions; +using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.Controls; using Ringtoets.Common.Forms.Properties; @@ -52,8 +53,7 @@ private readonly Observer failureMechanismObserver; private readonly Observer failureMechanismSectionResultObserver; private readonly RecursiveObserver, TSectionResult> failureMechanismSectionResultsObserver; - private TAssemblyResultControl failureMechanismAssemblyResultControl; - private Action setFailureMechanismAssemblyResultAction; + protected TAssemblyResultControl FailureMechanismAssemblyResultControl; private IEnumerable sectionResultRows; private bool rowUpdating; @@ -78,7 +78,7 @@ } InitializeComponent(); - InitializeInfoIcon(); + InitializeFailureMechanismAssemblyResultPanel(); FailureMechanism = failureMechanism; this.failureMechanismSectionResults = failureMechanismSectionResults; @@ -151,18 +151,10 @@ protected abstract void AddDataGridColumns(); /// - /// Sets the correct failure mechanism assembly result control on the view. + /// Updates the content of the . /// - /// The control to set on the view. - /// The action to perform to update the data of the control. - protected void SetAssemblyResultControl(TAssemblyResultControl control, - Action setResultAction) - { - failureMechanismAssemblyResultControl = new TAssemblyResultControl(); - setFailureMechanismAssemblyResultAction = setResultAction; - TableLayoutPanel.Controls.Add(failureMechanismAssemblyResultControl, 1, 0); - } - + /// Thrown when the assembly result + /// could not be created. protected abstract void UpdateAssemblyResultControl(); /// @@ -198,24 +190,24 @@ private void UpdateFailureMechanismAssemblyResultControl() { - if (failureMechanismAssemblyResultControl != null && setFailureMechanismAssemblyResultAction != null) + try { - try - { - setFailureMechanismAssemblyResultAction(); - failureMechanismAssemblyResultControl.ClearError(); - } - catch (Exception e) - { - failureMechanismAssemblyResultControl.SetError(e.Message); - } + UpdateAssemblyResultControl(); + FailureMechanismAssemblyResultControl.ClearError(); } + catch (AssemblyException e) + { + FailureMechanismAssemblyResultControl.SetError(e.Message); + } } - private void InitializeInfoIcon() + private void InitializeFailureMechanismAssemblyResultPanel() { infoIcon.BackgroundImage = CoreCommonGuiResources.information; toolTip.SetToolTip(infoIcon, Resources.FailureMechanismResultView_InfoToolTip); + + FailureMechanismAssemblyResultControl = new TAssemblyResultControl(); + TableLayoutPanel.Controls.Add(FailureMechanismAssemblyResultControl, 1, 0); } private void RemoveSectionResultRowEvents()