Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026:

  • deleted JsonItemArrayControl and JsonItemDefaultControl
  • redesigned architecture for JsonItem: now there are different types of JsonItem (IntJsonItem, BoolJsonItem, ...) -> for better type safety and expandability
  • fixed bug in BaseConverter for GetMinValue and GetMaxValue for IntValue, but ignored for other value types (DoubleValue, DateTimeValue, ...) because the redesign of JsonItem-Architecture can make these two methods obsolet soon
  • fixed bug in JsonItemConverter to prevent null pointer exceptions
  • refactored value and range converters -> removed complicated generic ValueTypeValueConverter and ValueRangeConverter and implemented the necessary methods directly in concrete classes (improves readability and removes the need of reflection)
  • redesigned view handling in OptimizerIntegration -> dynamically seaches for JsonItemVMBase implementations, which are connected with a view
    • this enables better scaling with more user controls
  • JsonItemVMBase implements MVVM architecture
File size: 1.7 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 : JsonItemBaseControl {
14
15    public JsonItemRangeControl(DoubleRangeVM vm) : base(vm) {
16      InitializeComponent();
17      /*
18      this.isDouble = isDouble;
19      textBoxValueFrom.Text = ((Array)VM.Item.Value).GetValue(0).ToString();
20      textBoxValueTo.Text = ((Array)VM.Item.Value).GetValue(1).ToString();
21      textBoxValueFrom.Text = VM.Item.Range.First().ToString();
22      textBoxValueTo.Text = VM.Item.Range.Last().ToString();
23      */
24    }
25    /*
26    protected abstract object Parse(string s);
27
28    private void SetValue() {
29      if (!string.IsNullOrWhiteSpace(textBoxValueFrom.Text))
30        value[0] = Parse(textBoxValueFrom.Text);
31      else
32        value[0] = ((Array)VM.Item.Value).GetValue(0);
33
34      if (!string.IsNullOrWhiteSpace(textBoxValueTo.Text))
35        value[1] = Parse(textBoxValueTo.Text);
36      else
37        value[1] = ((Array)VM.Item.Value).GetValue(1);
38      VM.Item.Value = value;
39    }
40   
41    private void textBoxValueFrom_Leave(object sender, EventArgs e) {
42      SetValue();
43    }
44
45    private void textBoxValueTo_Leave(object sender, EventArgs e) {
46      SetValue();
47    }
48
49    private void numericRangeControl1_Load(object sender, EventArgs e) {
50      numericRangeControl1.IsDouble = isDouble;
51      numericRangeControl1.VM = VM;
52    }
53    */
54  }
55}
Note: See TracBrowser for help on using the repository browser.