Free cookie consent management tool by TermsFeed Policy Generator

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

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

#3026:

  • refactored inheritance structure of json items, now the default JsonItem is an abstract class without properties Value and Range -> splitted up into new interfaces
  • updated view models for new json item structure
  • updated SingleLineArrayJsonWriter
File size: 1.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7namespace HeuristicLab.JsonInterface.OptimizerIntegration {
8
9  public abstract class RangedValueBaseVM<T, JsonItemType> : JsonItemVMBase<JsonItemType>
10    where T : IComparable
11    where JsonItemType : class, IIntervalRestrictedJsonItem<T>
12  {
13    public T MinRange {
14      get => Item.Minimum;
15      set {
16        Item.Minimum = value;
17        OnPropertyChange(this, nameof(MinRange));
18      }
19    }
20
21    public T MaxRange {
22      get => Item.Maximum;
23      set {
24        Item.Maximum = value;
25        OnPropertyChange(this, nameof(MaxRange));
26      }
27    }
28
29    private bool enableMinRange = false;
30    public bool EnableMinRange {
31      get => enableMinRange;
32      set {
33        enableMinRange = value;
34        if (!enableMinRange)
35          MinRange = MinTypeValue;
36        OnPropertyChange(this, nameof(EnableMinRange));
37      }
38    }
39
40    private bool enableMaxRange = false;
41    public bool EnableMaxRange {
42      get => enableMaxRange;
43      set {
44        enableMaxRange = value;
45        if (!enableMaxRange)
46          MaxRange = MaxTypeValue;
47        OnPropertyChange(this, nameof(EnableMaxRange));
48      }
49    }
50   
51    protected abstract T MinTypeValue { get; }
52    protected abstract T MaxTypeValue { get; }
53  }
54}
Note: See TracBrowser for help on using the repository browser.