Index: Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.cs
===================================================================
diff -u -r0dedee5ed4420b72929f83d86b139569fe8ee5cb -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.cs (.../LengthEffectSettingsControl.cs) (revision 0dedee5ed4420b72929f83d86b139569fe8ee5cb)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.cs (.../LengthEffectSettingsControl.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -37,16 +37,19 @@
{
private const int lengthEffectNNrOfDecimals = 2;
- private double b;
+ private readonly double b;
private ScenarioConfigurationPerFailureMechanismSection scenarioConfigurationPerFailureMechanismSection;
private bool isParameterAUpdating;
///
/// Creates a new instance of .
///
- public LengthEffectSettingsControl()
+ /// The 'b' parameter used to factor in the 'length effect' when determining
+ /// the maximum tolerated probability of failure.
+ public LengthEffectSettingsControl(double b)
{
+ this.b = b;
InitializeComponent();
InitializeToolTips();
}
@@ -55,12 +58,9 @@
/// Sets the data on the control.
///
/// The scenario configuration to set on the control.
- /// The 'b' parameter used to factor in the 'length effect' when determining
- /// the maximum tolerated probability of failure.
/// Thrown when
/// is null.
- public void SetData(ScenarioConfigurationPerFailureMechanismSection scenarioConfiguration,
- double b)
+ public void SetData(ScenarioConfigurationPerFailureMechanismSection scenarioConfiguration)
{
if (scenarioConfiguration == null)
{
@@ -69,7 +69,6 @@
ClearLengthEffectErrorMessage();
- this.b = b;
scenarioConfigurationPerFailureMechanismSection = scenarioConfiguration;
UpdateLengthEffectData();
Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/LengthEffectSettingsControlTest.cs
===================================================================
diff -u -r0dedee5ed4420b72929f83d86b139569fe8ee5cb -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/LengthEffectSettingsControlTest.cs (.../LengthEffectSettingsControlTest.cs) (revision 0dedee5ed4420b72929f83d86b139569fe8ee5cb)
+++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/LengthEffectSettingsControlTest.cs (.../LengthEffectSettingsControlTest.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -98,11 +98,10 @@
public void SetScenarioConfiguration_ScenarioConfigurationNull_ThrowsArgumentNullException()
{
// Setup
- var random = new Random(21);
LengthEffectSettingsControl control = ShowLengthEffectSettingsControl();
// Call
- void Call() => control.SetData(null, random.NextDouble());
+ void Call() => control.SetData(null);
// Assert
var exception = Assert.Throws(Call);
@@ -124,7 +123,7 @@
});
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
// Precondition
var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
@@ -135,7 +134,7 @@
Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
// When
- settingsControl.SetData(scenarioConfiguration, b);
+ settingsControl.SetData(scenarioConfiguration);
// Then
Assert.AreEqual("0,700", parameterATextBox.Text);
@@ -159,8 +158,8 @@
});
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, b);
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
+ settingsControl.SetData(scenarioConfiguration);
// Precondition
var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
@@ -189,8 +188,8 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, random.NextDouble());
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
parameterATextBoxTester.Enter("NotADouble");
@@ -218,8 +217,8 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, random.NextDouble());
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
parameterATextBoxTester.Enter("NotADouble");
@@ -251,8 +250,8 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, random.NextDouble());
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
parameterATextBoxTester.Enter("NotADouble");
@@ -266,7 +265,7 @@
// When
var newConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection(),
random.NextRoundedDouble());
- settingsControl.SetData(newConfiguration, random.NextDouble());
+ settingsControl.SetData(newConfiguration);
// Then
errorMessage = errorProvider.GetError(parameterATextBox);
@@ -282,8 +281,8 @@
FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, random.NextDouble());
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
@@ -325,8 +324,8 @@
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
scenarioConfiguration.Attach(observer);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, b);
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
+ settingsControl.SetData(scenarioConfiguration);
// Precondition
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
@@ -365,8 +364,8 @@
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
scenarioConfiguration.Attach(observer);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, b);
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
+ settingsControl.SetData(scenarioConfiguration);
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
const Keys keyData = Keys.Escape;
@@ -406,8 +405,8 @@
});
var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(scenarioConfiguration, b);
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
+ settingsControl.SetData(scenarioConfiguration);
// Precondition
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
@@ -440,8 +439,8 @@
});
var oldConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
- LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl();
- settingsControl.SetData(oldConfiguration, b);
+ LengthEffectSettingsControl settingsControl = ShowLengthEffectSettingsControl(b);
+ settingsControl.SetData(oldConfiguration);
// Precondition
TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
@@ -452,7 +451,7 @@
// When
var newConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) 0.7);
- settingsControl.SetData(newConfiguration, b);
+ settingsControl.SetData(newConfiguration);
oldConfiguration.NotifyObservers();
// Then
@@ -487,8 +486,14 @@
private LengthEffectSettingsControl ShowLengthEffectSettingsControl()
{
- var control = new LengthEffectSettingsControl();
+ var random = new Random(21);
+ return ShowLengthEffectSettingsControl(random.NextDouble());
+ }
+ private LengthEffectSettingsControl ShowLengthEffectSettingsControl(double b)
+ {
+ var control = new LengthEffectSettingsControl(b);
+
testForm.Controls.Add(control);
testForm.Show();
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs
===================================================================
diff -u -r38cc2066df6df5e409d0e160b35b0b1aa6fae54b -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision 38cc2066df6df5e409d0e160b35b0b1aa6fae54b)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -49,7 +49,6 @@
this.listBox = new System.Windows.Forms.ListBox();
this.calculationsTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.calculationSettingsGroupBox = new System.Windows.Forms.GroupBox();
- this.lengthEffectSettingsControl = new Riskeer.Common.Forms.Controls.LengthEffectSettingsControl();
this.dataGridViewControlGroupBox = new System.Windows.Forms.GroupBox();
this.dataGridViewControlTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.labelTotalScenarioContribution = new System.Windows.Forms.Label();
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs
===================================================================
diff -u -r6a62fa4a5b55c1d92893c9346ac2d22efe3302cd -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision 6a62fa4a5b55c1d92893c9346ac2d22efe3302cd)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -30,6 +30,7 @@
using Core.Common.Util.Extensions;
using Riskeer.Common.Data.Calculation;
using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Forms.Controls;
using Riskeer.MacroStabilityInwards.Data;
using Riskeer.MacroStabilityInwards.Forms.PresentationObjects;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
@@ -82,6 +83,7 @@
InitializeObservers();
+ lengthEffectSettingsControl = new LengthEffectSettingsControl(failureMechanism.GeneralInput.B);
InitializeComponent();
InitializeListBox();
@@ -296,8 +298,7 @@
if (selectedFailureMechanismSection != null)
{
- lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection,
- failureMechanism.GeneralInput.B);
+ lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
}
}
}
Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs
===================================================================
diff -u -r38cc2066df6df5e409d0e160b35b0b1aa6fae54b -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs (.../PipingScenariosView.Designer.cs) (revision 38cc2066df6df5e409d0e160b35b0b1aa6fae54b)
+++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs (.../PipingScenariosView.Designer.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -57,7 +57,6 @@
this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl();
this.calculationSettingsGroupBox = new System.Windows.Forms.GroupBox();
this.calculationSettingsTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
- this.lengthEffectSettingsControl = new Riskeer.Common.Forms.Controls.LengthEffectSettingsControl();
this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
this.radioButtonsPanel = new System.Windows.Forms.FlowLayoutPanel();
this.radioButtonSemiProbabilistic = new System.Windows.Forms.RadioButton();
Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs
===================================================================
diff -u -r231d49a3680dfdeef619dcaa26c743a093716c71 -rd669c3342fcc3ef7cd94b231e962b827378fe0f6
--- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs (.../PipingScenariosView.cs) (revision 231d49a3680dfdeef619dcaa26c743a093716c71)
+++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs (.../PipingScenariosView.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
@@ -31,6 +31,7 @@
using Core.Common.Util.Extensions;
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
+using Riskeer.Common.Forms.Controls;
using Riskeer.Piping.Data;
using Riskeer.Piping.Data.Probabilistic;
using Riskeer.Piping.Data.SemiProbabilistic;
@@ -101,6 +102,7 @@
InitializeObservers();
+ lengthEffectSettingsControl = new LengthEffectSettingsControl(failureMechanism.GeneralInput.B);
InitializeComponent();
InitializeCombobox();
@@ -442,8 +444,7 @@
if (selectedFailureMechanismSection != null)
{
- lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection,
- failureMechanism.GeneralInput.B);
+ lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
}
}
}