// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Core.Common.Controls.Views;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.Integration.Data;
using CommonGuiResources = Core.Common.Gui.Properties.Resources;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
namespace Ringtoets.Integration.Forms.Views
{
///
/// The view for the combined assembly result for all failure mechanisms of
/// the .
///
public partial class AssemblyResultTotalView : UserControl, IView
{
///
/// Creates a new instance of .
///
/// The to create the view for.
/// Thrown when
/// is null.
public AssemblyResultTotalView(AssessmentSection assessmentSection)
{
if (assessmentSection == null)
{
throw new ArgumentNullException(nameof(assessmentSection));
}
AssessmentSection = assessmentSection;
InitializeComponent();
InitializeDataGridView();
SetData();
}
///
/// Gets the the view belongs to.
///
public AssessmentSection AssessmentSection { get; }
public object Data { get; set; }
private void InitializeDataGridView()
{
dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Name),
CommonGuiResources.FailureMechanismContributionView_GridColumn_Assessment,
true);
dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Code),
RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName,
true);
dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRow.Group),
RingtoetsCommonFormsResources.FailureMechanism_Group_DisplayName,
true);
}
private void SetData()
{
var rows = new List
{
new FailureMechanismAssemblyResultRow(AssessmentSection.Piping, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.GrassCoverErosionInwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.MacroStabilityInwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.MacroStabilityOutwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.Microstability, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.StabilityStoneCover, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.WaveImpactAsphaltCover, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.WaterPressureAsphaltCover, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.GrassCoverErosionOutwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.GrassCoverSlipOffOutwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.GrassCoverSlipOffInwards, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.HeightStructures, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.ClosingStructures, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.PipingStructure, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.StabilityPointStructures, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.StrengthStabilityLengthwiseConstruction, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.DuneErosion, GetFailureMechanismAssembly),
new FailureMechanismAssemblyResultRow(AssessmentSection.TechnicalInnovation, GetFailureMechanismAssembly)
};
dataGridViewControl.SetDataSource(rows);
}
private static FailureMechanismAssembly GetFailureMechanismAssembly()
{
var random = new Random();
return new FailureMechanismAssembly(random.NextDouble(), FailureMechanismAssemblyCategoryGroup.IIIt);
}
}
}