using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using HeuristicLab.Core.Views; using HeuristicLab.Core; using HeuristicLab.MainForm; using System.Windows.Forms; using HeuristicLab.PluginInfrastructure; namespace HeuristicLab.Problems.MetaOptimization.Views { [View("Constrained Item List View")] [Content(typeof(ConstrainedItemList<>), IsDefaultView = true)] public sealed partial class ConstrainedItemListView : ItemListView where T : class, IItem { public new ConstrainedItemList Content { get { return (ConstrainedItemList)base.Content; } set { base.Content = value; } } public ConstrainedItemListView() { InitializeComponent(); } protected override T CreateItem() { if (typeSelectorDialog == null) { typeSelectorDialog = new TypeSelectorDialog(); typeSelectorDialog.Caption = "Select Item"; typeSelectorDialog.TypeSelector.Caption = "Available Items"; typeSelectorDialog.TypeSelector.Configure(Content.Type, false, true); } if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { try { return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); } catch (Exception ex) { ErrorHandling.ShowErrorDialog(this, ex); } } return null; } } }