Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ValueConfigurationViews/ValueView.cs @ 4839

Last change on this file since 4839 was 4839, checked in by cneumuel, 13 years ago

#1215 worked on MetaOptimization

  • split configurations into ValueConfigurations and ParameterConfigurations
File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.Core.Views;
10using HeuristicLab.MainForm;
11using HeuristicLab.Core;
12using HeuristicLab.Parameters.Views;
13using HeuristicLab.PluginInfrastructure;
14
15namespace 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}
Note: See TracBrowser for help on using the repository browser.