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.Threading.Tasks;
|
---|
9 | using System.Windows.Forms;
|
---|
10 | using System.Globalization;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.JsonInterface.OptimizerIntegration {
|
---|
13 |
|
---|
14 | public class JsonItemIntValueControl : JsonItemValueControl {
|
---|
15 |
|
---|
16 | #region Overriden Properties
|
---|
17 | protected override string ValuePropertyId => nameof(IntValueVM.Value);
|
---|
18 | protected override string MinRangePropertyId => nameof(IntValueVM.MinRange);
|
---|
19 | protected override string MaxRangePropertyId => nameof(IntValueVM.MaxRange);
|
---|
20 | protected override string EnableMinRangePropertyId => nameof(IntValueVM.EnableMinRange);
|
---|
21 | protected override string EnableMaxRangePropertyId => nameof(IntValueVM.EnableMaxRange);
|
---|
22 | #endregion
|
---|
23 |
|
---|
24 | public JsonItemIntValueControl(IntValueVM vm) : base(vm) {
|
---|
25 | Init();
|
---|
26 | }
|
---|
27 |
|
---|
28 | }
|
---|
29 |
|
---|
30 | public class JsonItemDoubleValueControl : JsonItemValueControl {
|
---|
31 |
|
---|
32 | #region Overriden Properties
|
---|
33 | protected override string ValuePropertyId => nameof(DoubleValueVM.Value);
|
---|
34 | protected override string MinRangePropertyId => nameof(DoubleValueVM.MinRange);
|
---|
35 | protected override string MaxRangePropertyId => nameof(DoubleValueVM.MaxRange);
|
---|
36 | protected override string EnableMinRangePropertyId => nameof(DoubleValueVM.EnableMinRange);
|
---|
37 | protected override string EnableMaxRangePropertyId => nameof(DoubleValueVM.EnableMaxRange);
|
---|
38 | #endregion
|
---|
39 |
|
---|
40 | public JsonItemDoubleValueControl(DoubleValueVM vm) : base(vm) {
|
---|
41 | Init();
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 | public abstract partial class JsonItemValueControl : JsonItemBaseControl {
|
---|
47 | #region Protected Properties
|
---|
48 | protected TextBox TBValue { get; set; }
|
---|
49 | protected NumericRangeControl NumericRangeControl { get; set; }
|
---|
50 | #endregion
|
---|
51 |
|
---|
52 | #region Abstract Properties
|
---|
53 | protected abstract string ValuePropertyId { get; }
|
---|
54 | protected abstract string MinRangePropertyId { get; }
|
---|
55 | protected abstract string MaxRangePropertyId { get; }
|
---|
56 | protected abstract string EnableMinRangePropertyId { get; }
|
---|
57 | protected abstract string EnableMaxRangePropertyId { get; }
|
---|
58 | #endregion
|
---|
59 |
|
---|
60 | public JsonItemValueControl(JsonItemVMBase vm) : base(vm) {
|
---|
61 | InitializeComponent();
|
---|
62 | TBValue = textBoxValue;
|
---|
63 | NumericRangeControl = numericRangeControl1;
|
---|
64 | }
|
---|
65 |
|
---|
66 | protected void Init() {
|
---|
67 | TBValue.DataBindings.Add("Text", base.VM, ValuePropertyId);
|
---|
68 | NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, MinRangePropertyId);
|
---|
69 | NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, MaxRangePropertyId);
|
---|
70 | NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, EnableMinRangePropertyId,
|
---|
71 | false, DataSourceUpdateMode.OnPropertyChanged);
|
---|
72 | NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, EnableMaxRangePropertyId,
|
---|
73 | false, DataSourceUpdateMode.OnPropertyChanged);
|
---|
74 | }
|
---|
75 |
|
---|
76 | }
|
---|
77 | }
|
---|