コード例 #1
0
 private void InitializeDataGridView()
 {
     DataGridViewControl.AddCheckBoxColumn(nameof(SelectableRow <PipingSurfaceLine> .Selected),
                                           RiskeerCommonFormsResources.SelectionDialogBase_ColumnSelect_DisplayName);
     DataGridViewControl.AddTextBoxColumn(nameof(SelectableRow <PipingSurfaceLine> .Name),
                                          RiskeerCommonFormsResources.SurfaceLine_DisplayName, true, DataGridViewAutoSizeColumnMode.Fill);
 }
コード例 #2
0
 /// <summary>
 /// Initializes the <see cref="DataGridView"/>.
 /// <param name="nameColumnHeader">Display name of the column header for <see cref="SelectableRow{T}.Name"/>.</param>
 /// </summary>
 protected void InitializeDataGridView(string nameColumnHeader)
 {
     DataGridViewControl.AddCheckBoxColumn(nameof(SelectableRow <T> .Selected),
                                           Resources.SelectionDialogBase_ColumnSelect_DisplayName);
     DataGridViewControl.AddTextBoxColumn(nameof(SelectableRow <T> .Name),
                                          nameColumnHeader, true, DataGridViewAutoSizeColumnMode.Fill);
 }
コード例 #3
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);
        }
コード例 #4
0
        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}");
        }
        /// <summary>
        /// Adds a column to the <paramref name="dataGridViewControl"/> showing the assembly group.
        /// </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>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static void AddAssemblyGroupColumn(DataGridViewControl dataGridViewControl, string dataPropertyName)
        {
            if (dataGridViewControl == null)
            {
                throw new ArgumentNullException(nameof(dataGridViewControl));
            }

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

            dataGridViewControl.AddTextBoxColumn(
                dataPropertyName,
                Resources.AssemblyGroup_DisplayName);
        }
        /// <summary>
        /// Adds a column to the <paramref name="dataGridViewControl"/> showing the section N.
        /// </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>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static void AddAssemblySectionNColumn(DataGridViewControl dataGridViewControl, string dataPropertyName)
        {
            if (dataGridViewControl == null)
            {
                throw new ArgumentNullException(nameof(dataGridViewControl));
            }

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

            dataGridViewControl.AddTextBoxColumn(
                dataPropertyName,
                Resources.FailureMechanismResultView_AssemblySectionN_Rounded_DisplayName);
        }
        /// <summary>
        /// Adds a column to the <paramref name="dataGridViewControl"/> showing the refined probability per section.
        /// </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>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static void AddRefinedSectionProbabilityColumn(DataGridViewControl dataGridViewControl, string dataPropertyName)
        {
            if (dataGridViewControl == null)
            {
                throw new ArgumentNullException(nameof(dataGridViewControl));
            }

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

            dataGridViewControl.AddTextBoxColumn(
                dataPropertyName,
                Resources.FailureMechanismResultView_RefinedSectionProbability_DisplayName);
        }
コード例 #8
0
        public void FormatCellWithColumnStateDefinition_WithArguments_FormatsCell(
            bool isReadOnly, string errorText, CellStyle cellStyle)
        {
            // Setup
            var definition = new DataGridViewColumnStateDefinition
            {
                ReadOnly  = isReadOnly,
                ErrorText = errorText,
                Style     = cellStyle
            };

            var mocks = new MockRepository();
            var row   = mocks.Stub <IHasColumnStateDefinitions>();

            row.Stub(r => r.ColumnStateDefinitions).Return(new Dictionary <int, DataGridViewColumnStateDefinition>
            {
                {
                    0, definition
                }
            });
            mocks.ReplayAll();

            using (var form = new Form())
                using (var dataGridViewControl = new DataGridViewControl())
                {
                    form.Controls.Add(dataGridViewControl);
                    form.Show();

                    dataGridViewControl.AddTextBoxColumn(null, "Test");
                    dataGridViewControl.SetDataSource(new[]
                    {
                        row
                    });

                    // Call
                    dataGridViewControl.FormatCellWithColumnStateDefinition(0, 0);

                    // Assert
                    DataGridViewCell cell = dataGridViewControl.Rows[0].Cells[0];
                    Assert.AreEqual(isReadOnly, cell.ReadOnly);
                    Assert.AreEqual(errorText, cell.ErrorText);
                    Assert.AreEqual(cellStyle.BackgroundColor, cell.Style.BackColor);
                    Assert.AreEqual(cellStyle.TextColor, cell.Style.ForeColor);

                    mocks.VerifyAll();
                }
        }
        /// <summary>
        /// Adds a column to the <paramref name="dataGridViewControl"/> showing the section name.
        /// </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>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public static void AddSectionNameColumn(DataGridViewControl dataGridViewControl, string dataPropertyName)
        {
            if (dataGridViewControl == null)
            {
                throw new ArgumentNullException(nameof(dataGridViewControl));
            }

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

            dataGridViewControl.AddTextBoxColumn(
                dataPropertyName,
                Resources.FailureMechanismSection_Name_DisplayName,
                true);
        }
コード例 #10
0
        protected override void AddColumns(Action addNameColumn, Action addHydraulicBoundaryLocationColumn)
        {
            addNameColumn();

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.CalculationType),
                Resources.PipingCalculationsView_InitializeDataGridView_Assessment_description);

            addHydraulicBoundaryLocationColumn();

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <PipingStochasticSoilModel> >(
                nameof(PipingCalculationRow.StochasticSoilModel),
                Resources.PipingInput_StochasticSoilModel_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <PipingStochasticSoilModel> .This),
                nameof(DataGridViewComboBoxItemWrapper <PipingStochasticSoilModel> .DisplayName));

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <PipingStochasticSoilProfile> >(
                nameof(PipingCalculationRow.StochasticSoilProfile),
                Resources.PipingInput_StochasticSoilProfile_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <PipingStochasticSoilProfile> .This),
                nameof(DataGridViewComboBoxItemWrapper <PipingStochasticSoilProfile> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.StochasticSoilProfileProbability),
                Resources.PipingCalculationsView_InitializeDataGridView_Stochastic_soil_profile_probability);

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.DampingFactorExitMean),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.PipingCalculationsView_DampingFactorExit_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.PhreaticLevelExitMean),
                $"{RiskeerCommonFormsResources.NormalDistribution_Mean_DisplayName}\r\n{Resources.PipingCalculationsView_PhreaticLevelExit_DisplayName}");

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.EntryPointL),
                Resources.PipingInput_EntryPointL_DisplayName);

            DataGridViewControl.AddTextBoxColumn(
                nameof(PipingCalculationRow.ExitPointL),
                Resources.PipingInput_ExitPointL_DisplayName);
        }
コード例 #11
0
        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}");
        }
コード例 #12
0
        public void FormatCellWithColumnStateDefinition_RowWithoutColumnStateDefinitions_DoesNotThrow()
        {
            // Setup
            using (var form = new Form())
                using (var dataGridViewControl = new DataGridViewControl())
                {
                    form.Controls.Add(dataGridViewControl);
                    form.Show();

                    dataGridViewControl.AddTextBoxColumn(null, "Test");
                    dataGridViewControl.SetDataSource(new[]
                    {
                        new object()
                    });

                    // Call
                    void Call() => dataGridViewControl.FormatCellWithColumnStateDefinition(0, 0);

                    // Assert
                    Assert.DoesNotThrow(Call);
                }
        }
コード例 #13
0
        protected override void AddColumns(Action addNameColumn, Action addHydraulicBoundaryLocationColumn)
        {
            addNameColumn();
            addHydraulicBoundaryLocationColumn();

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilModel> >(
                nameof(MacroStabilityInwardsCalculationRow.StochasticSoilModel),
                Resources.MacroStabilityInwardsInput_StochasticSoilModel_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilModel> .This),
                nameof(DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilModel> .DisplayName));

            DataGridViewControl.AddComboBoxColumn <DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile> >(
                nameof(MacroStabilityInwardsCalculationRow.StochasticSoilProfile),
                Resources.MacroStabilityInwardsInput_StochasticSoilProfile_DisplayName,
                null,
                nameof(DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile> .This),
                nameof(DataGridViewComboBoxItemWrapper <MacroStabilityInwardsStochasticSoilProfile> .DisplayName));

            DataGridViewControl.AddTextBoxColumn(
                nameof(MacroStabilityInwardsCalculationRow.StochasticSoilProfileProbability),
                Resources.MacroStabilityInwardsCalculationsView_InitializeDataGridView_Stochastic_soil_profile_probability);
        }
コード例 #14
0
 protected override void InitializeDataGridView()
 {
     DataGridViewControl.AddCheckBoxColumn(
         nameof(MacroStabilityInwardsScenarioRow.IsRelevant),
         RiskeerCommonFormsResources.ScenarioView_InitializeDataGridView_In_final_rating
         );
     DataGridViewControl.AddTextBoxColumn(
         nameof(MacroStabilityInwardsScenarioRow.Contribution),
         RiskeerCommonFormsResources.ScenarioView_InitializeDataGridView_Contribution
         );
     DataGridViewControl.AddTextBoxColumn(
         nameof(MacroStabilityInwardsScenarioRow.Name),
         RiskeerCommonFormsResources.ScenarioView_Name_DisplayName
         );
     DataGridViewControl.AddTextBoxColumn(
         nameof(MacroStabilityInwardsScenarioRow.FailureProbability),
         RiskeerCommonFormsResources.ScenarioView_ProfileFailureProbability_DisplayName
         );
     DataGridViewControl.AddTextBoxColumn(
         nameof(MacroStabilityInwardsScenarioRow.SectionFailureProbability),
         RiskeerCommonFormsResources.ScenarioView_SectionFailureProbability_DisplayName
         );
 }