Last change
on this file since 17446 was
17446,
checked in by dpiringe, 5 years ago
|
#3026:
- made interfaces for array/matrix JsonItems and for their VMs aswell (IArrayJsonItem, IArrayJsonItemVM, IMatrixJsonItem, IMatrixJsonItemVM), incl. base classes (ArrayJsonItemBase, ArrayValueVM, MatrixJsonItemBase, MatrixValueVM)
- changed inheritance structure for already existing array/matrix JsonItems -> they inherit now from new base array/matrix base classes
- added input elements to configure the size of an matrix or array in JsonItemMultiValueControl (incl. VM binding and validation)
- splitted file JsonItems.cs into separate files for their corresponding types (IntJsonItems.cs, DoubleJsonItems.cs, BoolJsonItems.cs, StringJsonItem.cs, DateTimeJsonItem.cs)
- changed location of deserialization of json values from JsonTemplateInstantiator into IJsonItem (implemented in JsonItem and set to virtual, overridden in MatrixJsonItemBase and ArrayJsonItemBase)
- added new CLI argument StringArgument
- some little UI improvements (location fixes, anchor fixes, ...)
|
File size:
1.5 KB
|
Line | |
---|
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> {
|
---|
11 | public override Type JsonItemType => typeof(IntJsonItem);
|
---|
12 |
|
---|
13 | protected override int MinTypeValue => int.MinValue;
|
---|
14 | protected override int MaxTypeValue => int.MaxValue;
|
---|
15 |
|
---|
16 | public override JsonItemBaseControl Control =>
|
---|
17 | new JsonItemIntValueControl(this);
|
---|
18 | }
|
---|
19 |
|
---|
20 | public class DoubleValueVM : SingleValueVM<double> {
|
---|
21 | public override Type JsonItemType => typeof(DoubleJsonItem);
|
---|
22 |
|
---|
23 | protected override double MinTypeValue => double.MinValue;
|
---|
24 | protected override double MaxTypeValue => double.MaxValue;
|
---|
25 |
|
---|
26 | public override JsonItemBaseControl Control =>
|
---|
27 | new JsonItemDoubleValueControl(this);
|
---|
28 | }
|
---|
29 |
|
---|
30 | public class BoolValueVM : SingleValueVM<bool> {
|
---|
31 | public override Type JsonItemType => typeof(BoolJsonItem);
|
---|
32 |
|
---|
33 | protected override bool MinTypeValue => false;
|
---|
34 | protected override bool MaxTypeValue => true;
|
---|
35 |
|
---|
36 | public override JsonItemBaseControl Control =>
|
---|
37 | new JsonItemBoolControl(this);
|
---|
38 | }
|
---|
39 |
|
---|
40 | public abstract class SingleValueVM<T> : RangedValueBaseVM<T> {
|
---|
41 |
|
---|
42 | public T Value {
|
---|
43 | get => Cast(Item.Value);
|
---|
44 | set {
|
---|
45 | Item.Value = value;
|
---|
46 | OnPropertyChange(this, nameof(Value));
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.