Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core.Views/3.3/OperatorSetView.cs @ 2818

Last change on this file since 2818 was 2818, checked in by swagner, 14 years ago

Operator architecture refactoring (#95)

  • corrected several bugs in order to get SGA working
File size: 1.6 KB
Line 
1using System.Windows.Forms;
2using HeuristicLab.Collections;
3using HeuristicLab.MainForm;
4
5namespace HeuristicLab.Core.Views {
6  [Content(typeof(OperatorSet), true)]
7  [Content(typeof(IObservableSet<IOperator>), false)]
8  public partial class OperatorSetView : ItemSetView<IOperator> {
9    protected TypeSelectorDialog typeSelectorDialog;
10
11    /// <summary>
12    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
13    /// </summary>
14    public OperatorSetView() {
15      InitializeComponent();
16      Caption = "Operator Set";
17      itemsGroupBox.Text = "&Operators";
18    }
19    /// <summary>
20    /// Initializes a new instance of <see cref="VariablesScopeView"/> with
21    /// the given <paramref name="scope"/>.
22    /// </summary>
23    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
24    /// <param name="scope">The scope whose variables should be represented visually.</param>
25    public OperatorSetView(IObservableSet<IOperator> content)
26      : this() {
27      Content = content;
28    }
29
30    protected override IOperator CreateItem() {
31      if (typeSelectorDialog == null) {
32        typeSelectorDialog = new TypeSelectorDialog();
33        typeSelectorDialog.TypeSelector.Caption = "&Available Operators";
34        typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false);
35      }
36
37      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)
38        return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
39      else
40        return null;
41    }
42  }
43}
Note: See TracBrowser for help on using the repository browser.