Exemple #1
0
        protected override void AddColumns(Action addNameColumn, Action addHydraulicBoundaryLocationColumn)
        {
            addNameColumn();
            addHydraulicBoundaryLocationColumn();

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <ForeshoreProfile> >(
                nameof(StabilityPointStructuresCalculationRow.ForeshoreProfile),
                RiskeerCommonFormsResources.Structure_ForeshoreProfile_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <ForeshoreProfile> .This),
                nameof(DataGridViewComboBoxItemWrapper <ForeshoreProfile> .DisplayName));

            DataGridViewControl.AddCheckBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.UseBreakWater),
                RiskeerCommonFormsResources.Use_BreakWater_DisplayName);

            DataGridViewControl.AddComboBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.BreakWaterType),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterType_DisplayName,
                EnumDisplayWrapperHelper.GetEnumTypes <BreakWaterType>(),
                nameof(EnumDisplayWrapper <BreakWaterType> .Value),
                nameof(EnumDisplayWrapper <BreakWaterType> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.BreakWaterHeight),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterHeight_DisplayName);

            DataGridViewControl.AddCheckBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.UseForeshoreGeometry),
                RiskeerCommonFormsResources.Use_Foreshore_DisplayName);

            DataGridViewControl.AddComboBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.LoadSchematizationType),
                RiskeerCommonFormsResources.LoadSchematizationType_DisplayName,
                EnumDisplayWrapperHelper.GetEnumTypes <LoadSchematizationType>(),
                nameof(EnumDisplayWrapper <LoadSchematizationType> .Value),
                nameof(EnumDisplayWrapper <LoadSchematizationType> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.ConstructiveStrengthLinearLoadModel),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.StabilityPointStructuresCalculationsView_ConstructiveStrength_Linear_LoadModel_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.ConstructiveStrengthQuadraticLoadModel),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.StabilityPointStructuresCalculationsView_ConstructiveStrength_Quadratic_LoadModel_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.StabilityLinearLoadModel),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.StabilityPointStructuresCalculationsView_Linear_LoadModel_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.StabilityQuadraticLoadModel),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.StabilityPointStructuresCalculationsView_Quadratic_LoadModel_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(StabilityPointStructuresCalculationRow.EvaluationLevel),
                RiskeerCommonFormsResources.Evaluation_Level_DisplayName);
        }
Exemple #2
0
        public void GetEnumTypes_Always_ReturnsCorrectEnumDisplayWrappers()
        {
            // Call
            EnumDisplayWrapper <TestEnumType>[] displayWrappers = EnumDisplayWrapperHelper.GetEnumTypes <TestEnumType>();

            // Assert
            Assert.AreEqual(3, displayWrappers.Length);
            Assert.AreEqual("Type1", displayWrappers[0].DisplayName);
            Assert.AreEqual(TestEnumType.Type1, displayWrappers[0].Value);
            Assert.AreEqual("Type2", displayWrappers[1].DisplayName);
            Assert.AreEqual(TestEnumType.Type2, displayWrappers[1].Value);
            Assert.AreEqual("Type3", displayWrappers[2].DisplayName);
            Assert.AreEqual(TestEnumType.Type3, displayWrappers[2].Value);
        }
        protected override void AddColumns(Action addNameColumn, Action addHydraulicBoundaryLocationColumn)
        {
            addNameColumn();
            addHydraulicBoundaryLocationColumn();

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <ForeshoreProfile> >(
                nameof(ClosingStructuresCalculationRow.ForeshoreProfile),
                RiskeerCommonFormsResources.Structure_ForeshoreProfile_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <ForeshoreProfile> .This),
                nameof(DataGridViewComboBoxItemWrapper <ForeshoreProfile> .DisplayName));

            DataGridViewControl.AddCheckBoxColumn(
                nameof(ClosingStructuresCalculationRow.UseBreakWater),
                RiskeerCommonFormsResources.Use_BreakWater_DisplayName);

            DataGridViewControl.AddComboBoxColumn(
                nameof(ClosingStructuresCalculationRow.BreakWaterType),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterType_DisplayName,
                EnumDisplayWrapperHelper.GetEnumTypes <BreakWaterType>(),
                nameof(EnumDisplayWrapper <BreakWaterType> .Value),
                nameof(EnumDisplayWrapper <BreakWaterType> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(ClosingStructuresCalculationRow.BreakWaterHeight),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterHeight_DisplayName);

            DataGridViewControl.AddCheckBoxColumn(
                nameof(ClosingStructuresCalculationRow.UseForeshoreGeometry),
                RiskeerCommonFormsResources.Use_Foreshore_DisplayName);

            DataGridViewControl.AddComboBoxColumn(
                nameof(ClosingStructuresCalculationRow.InflowModelType),
                RiskeerCommonFormsResources.Structure_InflowModelType_DisplayName,
                EnumDisplayWrapperHelper.GetEnumTypes <ClosingStructureInflowModelType>(),
                nameof(EnumDisplayWrapper <ClosingStructureInflowModelType> .Value),
                nameof(EnumDisplayWrapper <ClosingStructureInflowModelType> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(ClosingStructuresCalculationRow.MeanInsideWaterLevel),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.ClosingStructuresCalculationsView_InsideWaterLevel_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(ClosingStructuresCalculationRow.CriticalOvertoppingDischarge),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{RiskeerCommonFormsResources.StructuresCalculationsView_CriticalOvertoppingDischarge_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(ClosingStructuresCalculationRow.AllowedLevelIncreaseStorage),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{RiskeerCommonFormsResources.StructuresCalculationsView_AllowedLevelIncreaseStorage_DisplayName}");
        }
        protected override void AddColumns(Action addNameColumn, Action addHydraulicBoundaryLocationColumn)
        {
            addNameColumn();

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <DikeProfile> >(
                nameof(GrassCoverErosionInwardsCalculationRow.DikeProfile),
                Resources.DikeProfile_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <DikeProfile> .This),
                nameof(DataGridViewComboBoxItemWrapper <DikeProfile> .DisplayName));

            addHydraulicBoundaryLocationColumn();

            DataGridViewControl.AddCheckBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.UseBreakWater),
                RiskeerCommonFormsResources.Use_BreakWater_DisplayName);

            DataGridViewControl.AddComboBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.BreakWaterType),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterType_DisplayName,
                EnumDisplayWrapperHelper.GetEnumTypes <BreakWaterType>(),
                nameof(EnumDisplayWrapper <BreakWaterType> .Value),
                nameof(EnumDisplayWrapper <BreakWaterType> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.BreakWaterHeight),
                RiskeerCommonFormsResources.CalculationsView_BreakWaterHeight_DisplayName);

            DataGridViewControl.AddCheckBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.UseForeshoreGeometry),
                RiskeerCommonFormsResources.Use_Foreshore_DisplayName);

            DataGridViewControl.AddTextBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.DikeHeight),
                RiskeerCommonFormsResources.DikeHeight_DisplayName);

            DataGridViewControl.AddTextBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.MeanCriticalFlowRate),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.GrassCoverErosionInwardsCalculationsView_CriticalFlowRate_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(GrassCoverErosionInwardsCalculationRow.StandardDeviationCriticalFlowRate),
                $"{RiskeerCommonFormsResources.NormalDistribution_StandardDeviation_DisplayName}\r\n{Resources.GrassCoverErosionInwardsCalculationsView_CriticalFlowRate_DisplayName}");
        }
        /// <summary>
        /// Adds a column to the <paramref name="dataGridViewControl"/> showing a
        /// dropdown with items of <typeparamref name="T"/>.
        /// </summary>
        /// <param name="dataGridViewControl">The <see cref="DataGridViewControl"/> to add the column to.</param>
        /// <param name="dataPropertyName">The data property name of the column.</param>
        /// <typeparam name="T">The initial failure mechanism result type enum.</typeparam>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static void AddInitialFailureMechanismResultTypeColumn <T>(DataGridViewControl dataGridViewControl, string dataPropertyName)
        {
            if (dataGridViewControl == null)
            {
                throw new ArgumentNullException(nameof(dataGridViewControl));
            }

            if (dataPropertyName == null)
            {
                throw new ArgumentNullException(nameof(dataPropertyName));
            }

            IEnumerable <EnumDisplayWrapper <T> > dataSource = EnumDisplayWrapperHelper.GetEnumTypes <T>();

            dataGridViewControl.AddComboBoxColumn(
                dataPropertyName,
                Resources.FailureMechanismResultView_InitialFailureMechanismResultType_DisplayName,
                dataSource,
                nameof(EnumDisplayWrapper <T> .Value),
                nameof(EnumDisplayWrapper <T> .DisplayName));
        }
        public void AddProbabilityRefinementTypeColumn_WithParameters_AddsColumnToDataGridViewControl()
        {
            // Setup
            using (var form = new Form())
                using (var control = new DataGridViewControl())
                {
                    form.Controls.Add(control);
                    form.Show();
                    var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

                    // Precondition
                    Assert.AreEqual(0, dataGridView.ColumnCount);

                    // Call
                    FailureMechanismSectionResultViewColumnBuilder.AddProbabilityRefinementTypeColumn(control, dataPropertyName);

                    // Assert
                    Assert.AreEqual(1, dataGridView.ColumnCount);

                    var columnData = (DataGridViewComboBoxColumn)dataGridView.Columns[0];
                    Assert.AreEqual(dataPropertyName, columnData.DataPropertyName);
                    Assert.AreEqual("Aanscherpen faalkans", columnData.HeaderText);
                    Assert.AreEqual("Value", columnData.ValueMember);
                    Assert.AreEqual("DisplayName", columnData.DisplayMember);

                    IEnumerable <EnumDisplayWrapper <ProbabilityRefinementType> > expectedDataSource = EnumDisplayWrapperHelper.GetEnumTypes <ProbabilityRefinementType>();
                    AssertEnumDisplayWrappersAreEqual(expectedDataSource, (EnumDisplayWrapper <ProbabilityRefinementType>[])columnData.DataSource);
                }
        }