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(IParameterConfiguration), false)]
|
---|
18 | public partial class ValueView : ItemView {
|
---|
19 |
|
---|
20 | public new IParameterConfiguration Content {
|
---|
21 | get { return (IParameterConfiguration)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 | valueViewHost.Content = Content.Value;
|
---|
32 | }
|
---|
33 |
|
---|
34 | private void setValueButton_Click(object sender, EventArgs e) {
|
---|
35 | var typeSelectorDialog = new TypeSelectorDialog();
|
---|
36 | typeSelectorDialog.Caption = "Select Value";
|
---|
37 | typeSelectorDialog.TypeSelector.Configure(Content.ValueType, false, true);
|
---|
38 |
|
---|
39 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
|
---|
40 | try {
|
---|
41 | Content.Value = (IItem)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
42 | valueViewHost.Content = Content.Value;
|
---|
43 | }
|
---|
44 | catch (Exception ex) {
|
---|
45 | ErrorHandling.ShowErrorDialog(this, ex);
|
---|
46 | }
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | private void clearValueButton_Click(object sender, EventArgs e) {
|
---|
51 | Content.Value = null;
|
---|
52 | valueViewHost.Content = null;
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|