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