Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.cs @ 17464

Last change on this file since 17464 was 17464, checked in by dpiringe, 4 years ago

#3026:

  • Runner now uses SymbolicDataAnalysisExpressionMATLABFormatter to save instances of ISymbolicRegressionSolution
  • refactored user controls for detail view of json items, now they do not inherit from JsonItemBaseControl -> JsonItemBaseControl uses now an extra control
    • this change was made for fluid repositioning of controls (e.g. when no ActualName is present)
File size: 2.4 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.Threading.Tasks;
9using System.Windows.Forms;
10using System.Globalization;
11
12namespace HeuristicLab.JsonInterface.OptimizerIntegration {
13  public partial class JsonItemRangeControl : UserControl {
14    IJsonItemVM VM { get; set; }
15
16
17    public JsonItemRangeControl(DoubleRangeVM vm) {
18      InitializeComponent();
19      VM = vm;
20      textBoxValueFrom.DataBindings.Add("Text", vm, nameof(vm.MinValue));
21      textBoxValueTo.DataBindings.Add("Text", vm, nameof(vm.MaxValue));
22      InitNumbericRangeControl();
23
24    }
25    public JsonItemRangeControl(IntRangeVM vm) {
26      InitializeComponent();
27      VM = vm;
28      textBoxValueFrom.DataBindings.Add("Text", vm, nameof(vm.MinValue));
29      textBoxValueTo.DataBindings.Add("Text", vm, nameof(vm.MaxValue));
30      InitNumbericRangeControl();
31    }
32
33    private void InitNumbericRangeControl() {
34      numericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
35      numericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
36      numericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
37        false, DataSourceUpdateMode.OnPropertyChanged);
38      numericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
39        false, DataSourceUpdateMode.OnPropertyChanged);
40    }
41
42    /*
43    protected abstract object Parse(string s);
44
45    private void SetValue() {
46      if (!string.IsNullOrWhiteSpace(textBoxValueFrom.Text))
47        value[0] = Parse(textBoxValueFrom.Text);
48      else
49        value[0] = ((Array)VM.Item.Value).GetValue(0);
50
51      if (!string.IsNullOrWhiteSpace(textBoxValueTo.Text))
52        value[1] = Parse(textBoxValueTo.Text);
53      else
54        value[1] = ((Array)VM.Item.Value).GetValue(1);
55      VM.Item.Value = value;
56    }
57   
58    private void textBoxValueFrom_Leave(object sender, EventArgs e) {
59      SetValue();
60    }
61
62    private void textBoxValueTo_Leave(object sender, EventArgs e) {
63      SetValue();
64    }
65
66    private void numericRangeControl1_Load(object sender, EventArgs e) {
67      numericRangeControl1.IsDouble = isDouble;
68      numericRangeControl1.VM = VM;
69    }
70    */
71  }
72}
Note: See TracBrowser for help on using the repository browser.