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.Core.Views;
|
---|
10 | using HeuristicLab.MainForm;
|
---|
11 | using HeuristicLab.Core;
|
---|
12 | using HeuristicLab.Parameters.Views;
|
---|
13 | using HeuristicLab.PluginInfrastructure;
|
---|
14 |
|
---|
15 | namespace HeuristicLab.Problems.MetaOptimization.Views {
|
---|
16 | [View("Value View")]
|
---|
17 | [Content(typeof(IValueConfiguration), false)]
|
---|
18 | public partial class ValueView : ItemView {
|
---|
19 |
|
---|
20 | public new IValueConfiguration Content {
|
---|
21 | get { return (IValueConfiguration)base.Content; }
|
---|
22 | set { base.Content = value; }
|
---|
23 | }
|
---|
24 |
|
---|
25 | public ValueView() {
|
---|
26 | InitializeComponent();
|
---|
27 | }
|
---|
28 |
|
---|
29 | protected override void OnContentChanged() {
|
---|
30 | base.OnContentChanged();
|
---|
31 | if (Content != null) {
|
---|
32 | valueViewHost.Content = Content.Value;
|
---|
33 | } else {
|
---|
34 | valueViewHost.Content = null;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | private void setValueButton_Click(object sender, EventArgs e) {
|
---|
39 | var typeSelectorDialog = new TypeSelectorDialog();
|
---|
40 | typeSelectorDialog.Caption = "Select Value";
|
---|
41 | typeSelectorDialog.TypeSelector.Configure(Content.ValueDataType, false, true);
|
---|
42 |
|
---|
43 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
|
---|
44 | try {
|
---|
45 | Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
46 | valueViewHost.Content = Content.Value;
|
---|
47 | }
|
---|
48 | catch (Exception ex) {
|
---|
49 | ErrorHandling.ShowErrorDialog(this, ex);
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | private void clearValueButton_Click(object sender, EventArgs e) {
|
---|
55 | Content.Value = null;
|
---|
56 | valueViewHost.Content = null;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|