Changeset 17843 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels
- Timestamp:
- 02/23/21 16:36:44 (3 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs
r17828 r17843 1 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 2 using System.Windows.Forms; 8 3 … … 17 12 public ArrayValueVM() { } 18 13 19 public abstract T[] Value { get; set; }20 14 public bool Resizable { 21 15 get => Item.Resizable; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ConcreteRestrictedJsonItemVM.cs
r17828 r17843 1 using System; 2 using System.Collections.Generic; 1 using System.Collections.Generic; 3 2 using System.Linq; 4 using System.Text;5 using System.Threading.Tasks;6 3 using System.Windows.Forms; 7 4 … … 17 14 public override UserControl Control { 18 15 get { 19 var control = new ConcreteItemsRestrictor(); 20 control.Init(Item.ConcreteRestrictedItems); 16 var control = ConcreteItemsRestrictor.Create(Item.ConcreteRestrictedItems); 21 17 control.OnChecked += AddComboOption; 22 18 control.OnUnchecked += RemoveComboOption; 23 19 return control; 24 }25 }26 27 public V Value {28 get => Item.Value;29 set {30 Item.Value = value;31 OnPropertyChange(this, nameof(Value));32 20 } 33 21 } … … 40 28 41 29 if (!RangeContainsValue()) { 42 Value = GetDefaultValue();30 Item.Value = GetDefaultValue(); 43 31 44 32 //if no elements exists -> deselect item 45 33 if (Range.Count() == 0) 46 34 base.Selected = false; 47 48 OnPropertyChange(this, nameof(Value));49 35 } 50 36 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/DoubleVMs.cs
r17828 r17843 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Windows.Forms; 7 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 1 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 2 public class DoubleRangeVM : RangeVM<double, DoubleRangeJsonItem> { 10 3 protected override double MinTypeValue => double.MinValue; … … 15 8 protected override double MinTypeValue => double.MinValue; 16 9 protected override double MaxTypeValue => double.MaxValue; 17 public override double[] Value {18 get => Item.Value;19 set {20 Item.Value = value;21 OnPropertyChange(this, nameof(Value));22 }23 }24 10 } 25 11 26 12 public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> { 27 public override double[][] Value {28 get => Item.Value;29 set {30 Item.Value = value;31 OnPropertyChange(this, nameof(Value));32 }33 }34 13 protected override double MinTypeValue => double.MinValue; 35 14 protected override double MaxTypeValue => double.MaxValue; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/IntVMs.cs
r17828 r17843 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Windows.Forms; 7 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 1 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 2 public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> { 10 3 protected override int MinTypeValue => int.MinValue; 11 4 protected override int MaxTypeValue => int.MaxValue; 12 13 public override int[] Value {14 get => Item.Value;15 set {16 Item.Value = value;17 OnPropertyChange(this, nameof(Value));18 }19 }20 5 } 21 6 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs
r17828 r17843 1 1 using System; 2 using System.Collections.Generic;3 2 using System.ComponentModel; 4 3 using System.Drawing; 5 using System.Linq;6 using System.Text;7 using System.Threading.Tasks;8 4 using System.Windows.Forms; 9 5 … … 21 17 get => item; 22 18 set { 23 item?.LoosenPath();24 19 item = value; 25 item.FixatePath();26 20 ItemChanged?.Invoke(); 27 21 } … … 65 59 public event Action SelectedChanged; 66 60 67 68 61 protected void OnPropertyChange(object sender, string propertyName) { 69 62 // Make a temporary copy of the event to avoid possibility of … … 75 68 tmp?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 76 69 } 77 78 #region IDisposable Support79 private bool disposedValue = false; // To detect redundant calls80 81 protected virtual void Dispose(bool disposing) {82 if (!disposedValue) {83 if (disposing) {84 item.LoosenPath();85 item = null;86 }87 disposedValue = true;88 }89 }90 91 // This code added to correctly implement the disposable pattern.92 public void Dispose() {93 // Do not change this code. Put cleanup code in Dispose(bool disposing) above.94 Dispose(true);95 }96 #endregion97 70 } 98 71 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/LookupJsonItemVM.cs
r17828 r17843 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Windows.Forms; 1 using System.Windows.Forms; 7 2 8 3 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 4 public class LookupJsonItemVM : JsonItemVMBase<LookupJsonItem>, ILookupJsonItemVM { 10 5 public override UserControl Control => null; 11 public string ActualName {12 get => Item.ActualName;13 set {14 Item.ActualName = value;15 OnPropertyChange(this, nameof(ActualName));16 }17 }18 6 } 19 7 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs
r17828 r17843 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Linq;5 using System.Text;6 using System.Threading.Tasks;7 3 using System.Windows.Forms; 8 4 … … 16 12 public override UserControl Control => CompoundControl.Create(base.Control, MatrixJsonItemControl.Create(this)); 17 13 18 public abstract T[][] Value { get; set; }19 14 public bool RowsResizable { 20 15 get => Item.RowsResizable; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangeVM.cs
r17519 r17843 1 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 2 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 11 3 public abstract class RangeVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType> 12 4 where T : IComparable 13 5 where JsonItemType : class, IRangedJsonItem<T> 14 { 15 16 public T MinValue { 17 get => Item.MinValue; 18 set { 19 Item.MinValue = value; 20 OnPropertyChange(this, nameof(MinValue)); 21 } 22 } 23 24 public T MaxValue { 25 get => Item.MaxValue; 26 set { 27 Item.MaxValue = value; 28 OnPropertyChange(this, nameof(MaxValue)); 29 } 30 } 31 } 6 { } 32 7 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangedValueBaseVM.cs
r17828 r17843 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;5 using System.Threading.Tasks;6 2 using System.Windows.Forms; 7 3 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ResultItemVM.cs
r17834 r17843 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;5 using System.Threading.Tasks;6 2 using System.Windows.Forms; 7 3 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs
r17828 r17843 1 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 2 using System.Windows.Forms; 8 3 … … 10 5 11 6 public class BoolValueVM : JsonItemVMBase<BoolJsonItem> { 12 13 public bool Value {14 get => Item.Value;15 set {16 Item.Value = value;17 OnPropertyChange(this, nameof(Value));18 }19 }20 21 7 public override UserControl Control => null; 22 8 } … … 25 11 where T : IComparable 26 12 where JsonItemType : class, IIntervalRestrictedJsonItem<T>, IValueJsonItem<T> 27 { 28 29 public T Value { 30 get => Item.Value; 31 set { 32 Item.Value = value; 33 OnPropertyChange(this, nameof(Value)); 34 } 35 } 36 } 13 { } 37 14 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs
r17828 r17843 2 2 3 3 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 4 5 4 public class StringValueVM : ConcreteRestrictedJsonItemVM<StringJsonItem, string, string> { 6 5 protected override string GetDefaultValue() => Range.FirstOrDefault(); 7 8 protected override bool RangeContainsValue() => Range.Contains(Value); 6 protected override bool RangeContainsValue() => Range.Contains(Item.Value); 9 7 } 10 8 11 9 public class StringArrayVM : ConcreteRestrictedJsonItemVM<StringArrayJsonItem, string, string[]> { 12 10 protected override string[] GetDefaultValue() => Range.ToArray(); 13 14 protected override bool RangeContainsValue() => Value.All(x => Range.Any(y => x == y)); 11 protected override bool RangeContainsValue() => Item.Value.All(x => Range.Any(y => x == y)); 15 12 } 16 13 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ValueLookupJsonItemVM.cs
r17477 r17843 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;5 using System.Threading.Tasks;6 2 using System.Windows.Forms; 7 3 … … 9 5 public class ValueLookupJsonItemVM : LookupJsonItemVM, IValueLookupJsonItemVM { 10 6 public override Type TargetedJsonItemType => typeof(ValueLookupJsonItem); 11 public override UserControl Control => new ValueLookupJsonItemControl(this);7 public override UserControl Control => ValueLookupJsonItemControl.Create(this); 12 8 public IJsonItem JsonItemReference => ((IValueLookupJsonItem)Item).ActualValue; 13 9
Note: See TracChangeset
for help on using the changeset viewer.