using System; using System.Collections.Generic; using System.Windows.Forms; using Core.Common.Controls.Dialogs; using Ringtoets.Piping.Forms.Views; using Ringtoets.Piping.Primitives; using CommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Piping.Forms { /// /// A dialog which allows the user to make a selection form a given set of . Upon /// closing of the dialog, the selected can be obtained. /// public partial class PipingSurfaceLineSelectionDialog : DialogBase { /// /// Creates a new instance of . /// /// The parent of the dialog. /// The collection of to show in the dialog. public PipingSurfaceLineSelectionDialog(IWin32Window dialogParent, IEnumerable surfaceLines) : base(dialogParent, CommonFormsResources.GenerateScenariosIcon, 300, 400) { InitializeComponent(); PipingSurfaceLineSelectionView = new PipingSurfaceLineSelectionView(surfaceLines) { Dock = DockStyle.Fill }; Controls.Add(PipingSurfaceLineSelectionView); SelectedSurfaceLines = new List(); } /// /// Gets a collection of selected if they were selected /// in the dialog and a confirmation was given. If no confirmation was given or no /// was selected, then an empty collection is returned. /// public IEnumerable SelectedSurfaceLines { get; private set; } protected override Button GetCancelButton() { return CustomCancelButton; } private PipingSurfaceLineSelectionView PipingSurfaceLineSelectionView { get; set; } private void OkButtonOnClick(object sender, EventArgs e) { SelectedSurfaceLines = PipingSurfaceLineSelectionView.GetSelectedSurfaceLines(); Close(); } private void CancelButtonOnClick(object sender, EventArgs eventArgs) { Close(); } } }