source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.cs @ 17420

Last change on this file since 17420 was 17420, checked in by dpiringe, 9 months ago

#3026:

  • refactored ranged based VMs -> created new 'base' class for ranged based VMs RangedValueBaseVM
  • renamed AddChilds to AddChildren
  • implemented ArrayValueVM and JsonItemArrayValueControl
  • added ranges for array and matrix values
File size: 2.1 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
14  public class JsonItemIntValueControl : JsonItemValueControl {
15
16    #region Overriden Properties
17    protected override string ValuePropertyId => nameof(IntValueVM.Value);
18    #endregion
19
20    public JsonItemIntValueControl(IntValueVM vm) : base(vm) {
21      Init();
22    }
23
24  }
25
26  public class JsonItemDoubleValueControl : JsonItemValueControl {
27
28    #region Overriden Properties
29    protected override string ValuePropertyId => nameof(DoubleValueVM.Value);
30    #endregion
31
32    public JsonItemDoubleValueControl(DoubleValueVM vm) : base(vm) {
33      Init();
34    }
35
36  }
37
38  public abstract partial class JsonItemValueControl : JsonItemBaseControl {
39    #region Protected Properties
40    protected TextBox TBValue { get; set; }
41    protected NumericRangeControl NumericRangeControl { get; set; }
42    #endregion
43
44    #region Abstract Properties
45    protected abstract string ValuePropertyId { get; }
46    #endregion
47
48    public JsonItemValueControl(JsonItemVMBase vm) : base(vm) {
49      InitializeComponent();
50      TBValue = textBoxValue;
51      NumericRangeControl = numericRangeControl1;
52    }
53
54    protected void Init() {
55      TBValue.DataBindings.Add("Text", base.VM, ValuePropertyId);
56      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
57      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
58      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
59        false, DataSourceUpdateMode.OnPropertyChanged);
60      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
61        false, DataSourceUpdateMode.OnPropertyChanged);
62    }
63
64  }
65}
Note: See TracBrowser for help on using the repository browser.