Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/ConstrainedTypeValueView.cs @ 15740

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

#1215

  • changed AlgorithType and ProblemType to actually be types not objects. this eliminates redundant views for MetaOptimizationProblem
  • import algorithm for MetaOptimizationProblem
  • nicer dialog for combination creation
  • fixed iconimage for ParameterConfigurations
  • fixed ValidValues
File size: 2.0 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.MainForm;
10using HeuristicLab.Core.Views;
11
12namespace HeuristicLab.Problems.MetaOptimization.Views {
13  [View("ConstrainedTypeValueView")]
14  [Content(typeof(ConstrainedTypeValue), IsDefaultView = false)]
15  [Content(typeof(ConstrainedTypeValue<>), IsDefaultView = true)]
16  public sealed partial class ConstrainedTypeValueView : ItemView {
17    public new ConstrainedTypeValue Content {
18      get { return (ConstrainedTypeValue)base.Content; }
19      set { base.Content = value; }
20    }
21
22    public ConstrainedTypeValueView() {
23      InitializeComponent();
24    }
25
26    protected override void DeregisterContentEvents() {
27      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
28      base.DeregisterContentEvents();
29    }
30
31    protected override void RegisterContentEvents() {
32      base.RegisterContentEvents();
33      Content.ValueChanged += new EventHandler(Content_ValueChanged);
34    }
35
36    #region Event Handlers (Content)
37    void Content_ValueChanged(object sender, EventArgs e) {
38      if (InvokeRequired) {
39        Invoke(new EventHandler(Content_ValueChanged), sender, e);
40      } else {
41        this.typeComboBox.SelectedItem = Content.Value;
42      }
43    }
44    #endregion
45
46    protected override void OnContentChanged() {
47      base.OnContentChanged();
48      if (Content == null) {
49        typeComboBox.Items.Clear();
50      } else {
51        typeComboBox.Items.AddRange(Content.ValidTypes.ToArray());
52        Content_ValueChanged(this, EventArgs.Empty);
53      }
54    }
55
56    protected override void SetEnabledStateOfControls() {
57      base.SetEnabledStateOfControls();
58    }
59   
60    #region Event Handlers (child controls)
61    private void typeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
62      Content.Value = (Type)typeComboBox.SelectedItem;
63    }
64    #endregion
65  }
66}
Note: See TracBrowser for help on using the repository browser.