Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs
===================================================================
diff -u -r998fa47a674768b67849e33a5a43767a6374b7a0 -red611dc641e6c7e1e5906ffe81a40b79f78f68d7
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs (.../ClosingStructuresCalculationsView.cs) (revision 998fa47a674768b67849e33a5a43767a6374b7a0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/ClosingStructuresCalculationsView.cs (.../ClosingStructuresCalculationsView.cs) (revision ed611dc641e6c7e1e5906ffe81a40b79f78f68d7)
@@ -67,6 +67,10 @@
///
/// Creates a new instance of .
///
+ /// The data.
+ /// The failure mechanism.
+ /// The assessment section.
+ /// Thrown when any parameter is null.
public ClosingStructuresCalculationsView(CalculationGroup data, ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
{
if (data == null)
@@ -164,7 +168,7 @@
dataGridViewControl.AddComboBoxColumn(nameof(ClosingStructuresCalculationRow.BreakWaterType),
RiskeerCommonFormsResources.CalculationsView_BreakWaterType_DisplayName,
- GetBreakWaterTypes(),
+ GetEnumTypes(),
nameof(EnumDisplayWrapper.Value),
nameof(EnumDisplayWrapper.DisplayName));
@@ -177,7 +181,7 @@
dataGridViewControl.AddComboBoxColumn(nameof(ClosingStructuresCalculationRow.InflowModelType),
RiskeerCommonFormsResources.Structure_InflowModelType_DisplayName,
- GetInflowModelTypes(),
+ GetEnumTypes(),
nameof(EnumDisplayWrapper.Value),
nameof(EnumDisplayWrapper.DisplayName));
@@ -296,8 +300,7 @@
dataGridViewControl.AutoResizeColumns();
}
- var failureMechanismSection = listBox.SelectedItem as FailureMechanismSection;
- if (failureMechanismSection == null || calculationGroup == null)
+ if (!(listBox.SelectedItem is FailureMechanismSection failureMechanismSection))
{
dataGridViewControl.SetDataSource(null);
return;
@@ -429,22 +432,14 @@
}
}
- private static IEnumerable> GetBreakWaterTypes()
+ private static IEnumerable> GetEnumTypes()
{
- return Enum.GetValues(typeof(BreakWaterType))
- .OfType()
- .Select(bwt => new EnumDisplayWrapper(bwt))
+ return Enum.GetValues(typeof(T))
+ .OfType()
+ .Select(et => new EnumDisplayWrapper(et))
.ToArray();
}
- private static IEnumerable> GetInflowModelTypes()
- {
- return Enum.GetValues(typeof(ClosingStructureInflowModelType))
- .OfType()
- .Select(imt => new EnumDisplayWrapper(imt))
- .ToArray();
- }
-
private IEnumerable GetSelectableHydraulicBoundaryLocationsFromFailureMechanism()
{
List hydraulicBoundaryLocations = assessmentSection.HydraulicBoundaryDatabase.Locations;
@@ -509,7 +504,7 @@
{
listBox.Items.Clear();
- if (failureMechanism != null && failureMechanism.Sections.Any())
+ if (failureMechanism.Sections.Any())
{
listBox.Items.AddRange(failureMechanism.Sections.Cast