Last change
on this file since 17464 was
17464,
checked in by dpiringe, 5 years ago
|
#3026:
- Runner now uses SymbolicDataAnalysisExpressionMATLABFormatter to save instances of ISymbolicRegressionSolution
- refactored user controls for detail view of json items, now they do not inherit from JsonItemBaseControl -> JsonItemBaseControl uses now an extra control
- this change was made for fluid repositioning of controls (e.g. when no ActualName is present)
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.JsonInterface.OptimizerIntegration {
|
---|
8 | public class StringValueVM : JsonItemVMBase {
|
---|
9 | public override Type JsonItemType => typeof(StringJsonItem);
|
---|
10 | public override JsonItemBaseControl Control =>
|
---|
11 | new JsonItemBaseControl(this, new JsonItemValidValuesControl(this));
|
---|
12 |
|
---|
13 | public string Value {
|
---|
14 | get => Item.Value?.ToString();
|
---|
15 | set {
|
---|
16 | Item.Value = value;
|
---|
17 | OnPropertyChange(this, nameof(Value));
|
---|
18 | }
|
---|
19 | }
|
---|
20 |
|
---|
21 | public IEnumerable<string> Range {
|
---|
22 | get => Item.Range?.Cast<string>();
|
---|
23 | set {
|
---|
24 | Item.Range = value;
|
---|
25 | //check if value is still in range
|
---|
26 | if (!Range.Any(x => x == Value)) {
|
---|
27 | Value = Range.FirstOrDefault();
|
---|
28 | if (Range.Count() == 0)
|
---|
29 | //if no elements exists -> deselect item
|
---|
30 | base.Selected = false;
|
---|
31 | OnPropertyChange(this, nameof(Value));
|
---|
32 | }
|
---|
33 |
|
---|
34 | OnPropertyChange(this, nameof(Range));
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.