[2818] | 1 | using System.Windows.Forms;
|
---|
| 2 | using HeuristicLab.Collections;
|
---|
[2655] | 3 | using HeuristicLab.MainForm;
|
---|
| 4 |
|
---|
| 5 | namespace HeuristicLab.Core.Views {
|
---|
[2917] | 6 | [View("OperatorCollection View")]
|
---|
[2655] | 7 | [Content(typeof(OperatorCollection), true)]
|
---|
[2727] | 8 | [Content(typeof(IObservableCollection<IOperator>), false)]
|
---|
[2655] | 9 | public partial class OperatorCollectionView : ItemCollectionView<IOperator> {
|
---|
[2676] | 10 | protected TypeSelectorDialog typeSelectorDialog;
|
---|
[2655] | 11 |
|
---|
| 12 | /// <summary>
|
---|
| 13 | /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
|
---|
| 14 | /// </summary>
|
---|
| 15 | public OperatorCollectionView() {
|
---|
| 16 | InitializeComponent();
|
---|
| 17 | Caption = "Operator Collection";
|
---|
[2924] | 18 | itemsGroupBox.Text = "Operators";
|
---|
[2655] | 19 | }
|
---|
| 20 | /// <summary>
|
---|
| 21 | /// Initializes a new instance of <see cref="VariablesScopeView"/> with
|
---|
| 22 | /// the given <paramref name="scope"/>.
|
---|
| 23 | /// </summary>
|
---|
| 24 | /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
|
---|
| 25 | /// <param name="scope">The scope whose variables should be represented visually.</param>
|
---|
[2727] | 26 | public OperatorCollectionView(IObservableCollection<IOperator> content)
|
---|
[2655] | 27 | : this() {
|
---|
[2727] | 28 | Content = content;
|
---|
[2655] | 29 | }
|
---|
| 30 |
|
---|
| 31 | protected override IOperator CreateItem() {
|
---|
| 32 | if (typeSelectorDialog == null) {
|
---|
| 33 | typeSelectorDialog = new TypeSelectorDialog();
|
---|
[2924] | 34 | typeSelectorDialog.TypeSelector.Caption = "Available Operators";
|
---|
[2655] | 35 | typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)
|
---|
| 39 | return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
| 40 | else
|
---|
| 41 | return null;
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 | }
|
---|