Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026:

  • added property Description in IJsonItem and updated all construction calls
  • updated UnsupportedJsonItem with unsupported property Description
  • updated JsonItemBaseControl and JsonItemVMBase for new property Description
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  public class JsonItemDoubleValueControl : JsonItemValueControl {
26
27    #region Overriden Properties
28    protected override string ValuePropertyId => nameof(DoubleValueVM.Value);
29    #endregion
30
31    public JsonItemDoubleValueControl(DoubleValueVM vm) : base(vm) {
32      Init();
33    }
34  }
35 
36  public abstract partial class JsonItemValueControl : JsonItemBaseControl {
37    #region Protected Properties
38    protected TextBox TBValue { get; set; }
39    protected NumericRangeControl NumericRangeControl { get; set; }
40    #endregion
41
42    #region Abstract Properties
43    protected abstract string ValuePropertyId { get; }
44    #endregion
45
46    public JsonItemValueControl(JsonItemVMBase vm) : base(vm) {
47      InitializeComponent();
48      TBValue = textBoxValue;
49      NumericRangeControl = numericRangeControl1;
50    }
51
52    protected void Init() {
53      TBValue.DataBindings.Add("Text", base.VM, ValuePropertyId);
54      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
55      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
56      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
57        false, DataSourceUpdateMode.OnPropertyChanged);
58      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
59        false, DataSourceUpdateMode.OnPropertyChanged);
60    }
61
62  }
63}
Note: See TracBrowser for help on using the repository browser.