source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangedValueBaseVM.cs @ 17843

Last change on this file since 17843 was 17843, checked in by dpiringe, 7 weeks ago

#3026

  • removed property ConvertableType from all converters
  • removed the option to fixate or loosen the path of JsonItems (obsolete)
  • added a abstract formatter SymbolicRegressionSolutionFormatterBase as base formatter for ISymbolicRegressionSolution
  • unified the construction of exporter controls
  • code cleanup
File size: 1.4 KB
Line 
1using System;
2using System.Windows.Forms;
3
4namespace HeuristicLab.JsonInterface.OptimizerIntegration {
5
6  public abstract class RangedValueBaseVM<T, JsonItemType> : JsonItemVMBase<JsonItemType>
7    where T : IComparable
8    where JsonItemType : class, IIntervalRestrictedJsonItem<T>
9  {
10    public override UserControl Control => NumericRangeControl.Create(this);
11
12    public T MinRange {
13      get => Item.Minimum;
14      set {
15        Item.Minimum = value;
16        OnPropertyChange(this, nameof(MinRange));
17      }
18    }
19
20    public T MaxRange {
21      get => Item.Maximum;
22      set {
23        Item.Maximum = value;
24        OnPropertyChange(this, nameof(MaxRange));
25      }
26    }
27
28    private bool enableMinRange = false;
29    public bool EnableMinRange {
30      get => enableMinRange;
31      set {
32        enableMinRange = value;
33        if (!enableMinRange)
34          MinRange = MinTypeValue;
35        OnPropertyChange(this, nameof(EnableMinRange));
36      }
37    }
38
39    private bool enableMaxRange = false;
40    public bool EnableMaxRange {
41      get => enableMaxRange;
42      set {
43        enableMaxRange = value;
44        if (!enableMaxRange)
45          MaxRange = MaxTypeValue;
46        OnPropertyChange(this, nameof(EnableMaxRange));
47      }
48    }
49   
50    protected abstract T MinTypeValue { get; }
51    protected abstract T MaxTypeValue { get; }
52  }
53}
Note: See TracBrowser for help on using the repository browser.