Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 17828 was 17828, checked in by dpiringe, 3 years ago

#3026

  • removed the option to set the value for JsonItems via exporter
    • reworked some base controls
    • added new controls for JsonItem specific properties (e.g. ArrayResizable)
    • deleted a lot of obsolet controls
  • removed the Enable checkbox in the detail view of JsonItems
  • exporter now clones the IOptimizer object
  • added a check + message for unsupported exports
  • list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
  • refactored the converter type check
    • now every converter has to specify its supported type(s)
File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6using System.Windows.Forms;
7
8namespace HeuristicLab.JsonInterface.OptimizerIntegration {
9
10  public abstract class RangedValueBaseVM<T, JsonItemType> : JsonItemVMBase<JsonItemType>
11    where T : IComparable
12    where JsonItemType : class, IIntervalRestrictedJsonItem<T>
13  {
14    public override UserControl Control => NumericRangeControl.Create(this);
15
16    public T MinRange {
17      get => Item.Minimum;
18      set {
19        Item.Minimum = value;
20        OnPropertyChange(this, nameof(MinRange));
21      }
22    }
23
24    public T MaxRange {
25      get => Item.Maximum;
26      set {
27        Item.Maximum = value;
28        OnPropertyChange(this, nameof(MaxRange));
29      }
30    }
31
32    private bool enableMinRange = false;
33    public bool EnableMinRange {
34      get => enableMinRange;
35      set {
36        enableMinRange = value;
37        if (!enableMinRange)
38          MinRange = MinTypeValue;
39        OnPropertyChange(this, nameof(EnableMinRange));
40      }
41    }
42
43    private bool enableMaxRange = false;
44    public bool EnableMaxRange {
45      get => enableMaxRange;
46      set {
47        enableMaxRange = value;
48        if (!enableMaxRange)
49          MaxRange = MaxTypeValue;
50        OnPropertyChange(this, nameof(EnableMaxRange));
51      }
52    }
53   
54    protected abstract T MinTypeValue { get; }
55    protected abstract T MaxTypeValue { get; }
56  }
57}
Note: See TracBrowser for help on using the repository browser.