Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core.Views/3.3/OperatorCollectionView.cs @ 3188

Last change on this file since 3188 was 2924, checked in by swagner, 15 years ago

Operator architecture refactoring (#95)

  • implemented reviewers' comments on version r2917.
File size: 1.7 KB
Line 
1using System.Windows.Forms;
2using HeuristicLab.Collections;
3using HeuristicLab.MainForm;
4
5namespace HeuristicLab.Core.Views {
6  [View("OperatorCollection View")]
7  [Content(typeof(OperatorCollection), true)]
8  [Content(typeof(IObservableCollection<IOperator>), false)]
9  public partial class OperatorCollectionView : ItemCollectionView<IOperator> {
10    protected TypeSelectorDialog typeSelectorDialog;
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";
18      itemsGroupBox.Text = "Operators";
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>
26    public OperatorCollectionView(IObservableCollection<IOperator> content)
27      : this() {
28      Content = content;
29    }
30
31    protected override IOperator CreateItem() {
32      if (typeSelectorDialog == null) {
33        typeSelectorDialog = new TypeSelectorDialog();
34        typeSelectorDialog.TypeSelector.Caption = "Available Operators";
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}
Note: See TracBrowser for help on using the repository browser.