Last change
on this file since 17717 was
16996,
checked in by gkronber, 6 years ago
|
#2520 Update plugin dependencies and references for HL.MetaOptimization for new persistence
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Core.Views;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.MainForm;
|
---|
5 | using System.Windows.Forms;
|
---|
6 | using HeuristicLab.PluginInfrastructure;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Problems.MetaOptimization.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.