Last change
on this file since 11017 was
8517,
checked in by jkarder, 12 years ago
|
#1853:
- created branch for ParameterConfigurationEncoding
- added CreateExperimentDialog that uses the extracted encoding
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Windows.Forms;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.Core.Views;
|
---|
5 | using HeuristicLab.MainForm;
|
---|
6 | using HeuristicLab.PluginInfrastructure;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Encodings.ParameterConfigurationEncoding.Views {
|
---|
9 | [View("Constrained Item List View")]
|
---|
10 | [Content(typeof(ConstrainedItemList<>), IsDefaultView = true)]
|
---|
11 | public sealed partial class ConstrainedItemListView<T> : ItemListView<T> where T : class, IItem {
|
---|
12 | public new ConstrainedItemList<T> Content {
|
---|
13 | get { return (ConstrainedItemList<T>)base.Content; }
|
---|
14 | set { base.Content = value; }
|
---|
15 | }
|
---|
16 |
|
---|
17 | public ConstrainedItemListView() {
|
---|
18 | InitializeComponent();
|
---|
19 | }
|
---|
20 |
|
---|
21 | protected override T CreateItem() {
|
---|
22 | if (typeSelectorDialog == null) {
|
---|
23 | typeSelectorDialog = new TypeSelectorDialog();
|
---|
24 | typeSelectorDialog.Caption = "Select Item";
|
---|
25 | typeSelectorDialog.TypeSelector.Caption = "Available Items";
|
---|
26 | typeSelectorDialog.TypeSelector.Configure(Content.Type, false, true);
|
---|
27 | }
|
---|
28 |
|
---|
29 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
|
---|
30 | try {
|
---|
31 | return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
32 | }
|
---|
33 | catch (Exception ex) {
|
---|
34 | ErrorHandling.ShowErrorDialog(this, ex);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | return null;
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.