using System.Windows.Forms; using HeuristicLab.Collections; using HeuristicLab.MainForm; namespace HeuristicLab.Core.Views { [View("OperatorCollection View")] [Content(typeof(OperatorCollection), true)] [Content(typeof(IObservableCollection), false)] public partial class OperatorCollectionView : ItemCollectionView { protected TypeSelectorDialog typeSelectorDialog; /// /// Initializes a new instance of with caption "Variables Scope View". /// public OperatorCollectionView() { InitializeComponent(); Caption = "Operator Collection"; itemsGroupBox.Text = "Operators"; } /// /// Initializes a new instance of with /// the given . /// /// Calls . /// The scope whose variables should be represented visually. public OperatorCollectionView(IObservableCollection content) : this() { Content = content; } protected override IOperator CreateItem() { if (typeSelectorDialog == null) { typeSelectorDialog = new TypeSelectorDialog(); typeSelectorDialog.TypeSelector.Caption = "Available Operators"; typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false); } if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); else return null; } } }