1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Text;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 | using System.Windows.Forms;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.JsonInterface.OptimizerIntegration {
|
---|
10 | public class IntValueVM : SingleValueVM<int, IntJsonItem> {
|
---|
11 | public override Type TargetedJsonItemType => typeof(IntJsonItem);
|
---|
12 |
|
---|
13 | protected override int MinTypeValue => int.MinValue;
|
---|
14 | protected override int MaxTypeValue => int.MaxValue;
|
---|
15 |
|
---|
16 | public override UserControl Control =>
|
---|
17 | new JsonItemIntValueControl(this);
|
---|
18 | }
|
---|
19 |
|
---|
20 | public class DoubleValueVM : SingleValueVM<double, DoubleJsonItem> {
|
---|
21 | public override Type TargetedJsonItemType => typeof(DoubleJsonItem);
|
---|
22 |
|
---|
23 | protected override double MinTypeValue => double.MinValue;
|
---|
24 | protected override double MaxTypeValue => double.MaxValue;
|
---|
25 |
|
---|
26 | public override UserControl Control =>
|
---|
27 | new JsonItemDoubleValueControl(this);
|
---|
28 | }
|
---|
29 |
|
---|
30 | public class BoolValueVM : JsonItemVMBase<BoolJsonItem> {
|
---|
31 | public override Type TargetedJsonItemType => typeof(BoolJsonItem);
|
---|
32 |
|
---|
33 | public bool Value {
|
---|
34 | get => Item.Value;
|
---|
35 | set {
|
---|
36 | Item.Value = value;
|
---|
37 | OnPropertyChange(this, nameof(Value));
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | public override UserControl Control =>
|
---|
42 | new JsonItemBoolControl(this);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public abstract class SingleValueVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>
|
---|
46 | where T : IComparable
|
---|
47 | where JsonItemType : class, IIntervalRestrictedJsonItem<T>, IValueJsonItem<T>
|
---|
48 | {
|
---|
49 |
|
---|
50 | public T Value {
|
---|
51 | get => Item.Value;
|
---|
52 | set {
|
---|
53 | Item.Value = value;
|
---|
54 | OnPropertyChange(this, nameof(Value));
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|
58 | }
|
---|