Last change
on this file since 17590 was
17560,
checked in by dpiringe, 5 years ago
|
#3026:
- added an extra loop to add empty default results in Runner (to prevent not existing results)
- fixed a bug in JsonItemValidValuesControl, now the dropdown should not reset the default value
|
File size:
1.6 KB
|
Rev | Line | |
---|
[17410] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
[17471] | 5 | using System.Threading;
|
---|
[17410] | 6 | using System.Threading.Tasks;
|
---|
[17471] | 7 | using System.Windows.Forms;
|
---|
[17410] | 8 |
|
---|
| 9 | namespace HeuristicLab.JsonInterface.OptimizerIntegration {
|
---|
[17473] | 10 | public class StringValueVM : JsonItemVMBase<StringJsonItem> {
|
---|
[17471] | 11 | public override UserControl Control =>
|
---|
| 12 | new JsonItemValidValuesControl(this);
|
---|
[17410] | 13 |
|
---|
| 14 | public string Value {
|
---|
[17417] | 15 | get => Item.Value?.ToString();
|
---|
[17410] | 16 | set {
|
---|
[17412] | 17 | Item.Value = value;
|
---|
[17410] | 18 | OnPropertyChange(this, nameof(Value));
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
[17417] | 21 |
|
---|
| 22 | public IEnumerable<string> Range {
|
---|
[17473] | 23 | get => Item.ConcreteRestrictedItems;
|
---|
[17417] | 24 | set {
|
---|
[17473] | 25 | Item.ConcreteRestrictedItems = value;
|
---|
[17417] | 26 | //check if value is still in range
|
---|
[17560] | 27 | if (!Range.Contains(Value)) {
|
---|
[17417] | 28 | Value = Range.FirstOrDefault();
|
---|
| 29 | if (Range.Count() == 0)
|
---|
| 30 | //if no elements exists -> deselect item
|
---|
| 31 | base.Selected = false;
|
---|
| 32 | OnPropertyChange(this, nameof(Value));
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | OnPropertyChange(this, nameof(Range));
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
[17519] | 38 | }
|
---|
[17473] | 39 |
|
---|
[17519] | 40 | public class StringArrayVM : JsonItemVMBase<StringArrayJsonItem> {
|
---|
| 41 | public override UserControl Control =>
|
---|
| 42 | new JsonItemConcreteItemArrayControl(this);
|
---|
| 43 |
|
---|
| 44 | public string[] Value {
|
---|
| 45 | get => Item.Value;
|
---|
| 46 | set {
|
---|
| 47 | Item.Value = value;
|
---|
| 48 | OnPropertyChange(this, nameof(Value));
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | public IEnumerable<string> Range {
|
---|
| 53 | get => Item.ConcreteRestrictedItems;
|
---|
| 54 | set {
|
---|
| 55 | Item.ConcreteRestrictedItems = value;
|
---|
| 56 | OnPropertyChange(this, nameof(Range));
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
[17410] | 59 | }
|
---|
| 60 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.