Changeset 17417 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration
- Timestamp:
- 02/03/20 15:13:35 (4 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj
r17411 r17417 78 78 </ItemGroup> 79 79 <ItemGroup> 80 <Compile Include="Interfaces\IJsonItemValueParser.cs" />81 <Compile Include="Parser\JsonItemDoubleValueParser.cs" />82 <Compile Include="Parser\JsonItemIntValueParser.cs" />83 80 <Compile Include="Properties\Resources.Designer.cs"> 84 81 <AutoGen>True</AutoGen> … … 98 95 <DependentUpon>NumericRangeControl.cs</DependentUpon> 99 96 </Compile> 97 <Compile Include="ViewModels\ArrayValueVM.cs" /> 100 98 <Compile Include="ViewModels\JsonItemVMBase.cs" /> 101 99 <Compile Include="ViewModels\RangeVM.cs" /> … … 109 107 </Compile> 110 108 <Compile Include="FileManager.cs" /> 109 <Compile Include="Views\JsonItemArrayValueControl.cs"> 110 <SubType>UserControl</SubType> 111 </Compile> 112 <Compile Include="Views\JsonItemArrayValueControl.Designer.cs"> 113 <DependentUpon>JsonItemArrayValueControl.cs</DependentUpon> 114 </Compile> 111 115 <Compile Include="Views\JsonItemBoolControl.cs"> 112 116 <SubType>UserControl</SubType> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.cs
r17410 r17417 11 11 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 12 12 public partial class JsonItemBaseControl : UserControl { 13 pr ivateJsonItemVMBase VM { get; set; }13 protected JsonItemVMBase VM { get; set; } 14 14 15 15 private JsonItemBaseControl() { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs
r17412 r17417 12 12 13 13 public string Value { 14 get => Item.Value .ToString();14 get => Item.Value?.ToString(); 15 15 set { 16 16 Item.Value = value; … … 18 18 } 19 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 } 20 37 } 21 38 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17412 r17417 42 42 43 43 private IDictionary<Type, Type> JI2VM { get; set; } 44 45 44 46 45 private void InitCache() { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.Designer.cs
r17410 r17417 44 44 this.tableOptions.RowCount = 1; 45 45 this.tableOptions.RowStyles.Add(new System.Windows.Forms.RowStyle()); 46 this.tableOptions.Size = new System.Drawing.Size(478, 1 51);46 this.tableOptions.Size = new System.Drawing.Size(478, 137); 47 47 this.tableOptions.TabIndex = 12; 48 48 // … … 56 56 this.groupBoxRange.Location = new System.Drawing.Point(6, 108); 57 57 this.groupBoxRange.Name = "groupBoxRange"; 58 this.groupBoxRange.Size = new System.Drawing.Size(490, 1 76);58 this.groupBoxRange.Size = new System.Drawing.Size(490, 162); 59 59 this.groupBoxRange.TabIndex = 14; 60 60 this.groupBoxRange.TabStop = false; … … 91 91 this.ForeColor = System.Drawing.Color.Black; 92 92 this.Name = "JsonItemValidValuesControl"; 93 this.Size = new System.Drawing.Size(500, 2 90);93 this.Size = new System.Drawing.Size(500, 276); 94 94 this.Controls.SetChildIndex(this.groupBoxRange, 0); 95 95 this.Controls.SetChildIndex(this.comboBoxValues, 0); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs
r17410 r17417 14 14 public JsonItemValidValuesControl(StringValueVM vm) : base(vm) { 15 15 InitializeComponent(); 16 /* 17 foreach (var i in VM.Item.Range) { 18 AddOption((string)i); 19 if(i == VM.Item.Value) { 20 comboBoxValues.SelectedItem = (string)i; 21 } 22 }*/ 16 foreach (var i in VM.Item.Range) 17 SetupOption((string)i); 18 19 comboBoxValues.DataBindings.Add("SelectedItem", VM, nameof(StringValueVM.Value)); 23 20 } 24 /*25 private void AddOption(string opt) {21 22 private void SetupOption(string opt) { 26 23 AddComboOption(opt); 27 24 TextBox tb = new TextBox(); … … 50 47 items.Add((string)i); 51 48 } 52 VM.Item.Range = items; 49 ((StringValueVM)VM).Range = items; 50 comboBoxValues.Enabled = true; 53 51 tableOptions.Refresh(); 54 52 } … … 60 58 items.Add((string)i); 61 59 } 62 VM.Item.Range = items; 60 ((StringValueVM)VM).Range = items; 61 if (((StringValueVM)VM).Range.Count() <= 0) { 62 comboBoxValues.Enabled = false; 63 comboBoxValues.SelectedIndex = -1; 64 } 63 65 tableOptions.Refresh(); 64 66 } 65 66 private void comboBoxValues_SelectedValueChanged(object sender, EventArgs e) {67 VM.Item.Value = (string)comboBoxValues.SelectedItem;68 }69 70 private void JsonItemValidValuesControl_Load(object sender, EventArgs e) {71 72 }73 */74 67 } 75 68 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.cs
r17411 r17417 13 13 14 14 public class JsonItemIntValueControl : JsonItemValueControl { 15 private readonly IntValueVM vm;16 15 17 16 #region Overriden Properties 18 protected override object VM => vm;19 17 protected override string ValuePropertyId => nameof(IntValueVM.Value); 20 18 protected override string MinRangePropertyId => nameof(IntValueVM.MinRange); … … 25 23 26 24 public JsonItemIntValueControl(IntValueVM vm) : base(vm) { 27 this.vm = vm;28 25 Init(); 29 26 } … … 32 29 33 30 public class JsonItemDoubleValueControl : JsonItemValueControl { 34 private readonly DoubleValueVM vm;35 31 36 32 #region Overriden Properties 37 protected override object VM => vm;38 33 protected override string ValuePropertyId => nameof(DoubleValueVM.Value); 39 34 protected override string MinRangePropertyId => nameof(DoubleValueVM.MinRange); … … 44 39 45 40 public JsonItemDoubleValueControl(DoubleValueVM vm) : base(vm) { 46 this.vm = vm;47 41 Init(); 48 42 } … … 57 51 58 52 #region Abstract Properties 59 protected abstract object VM { get; }60 53 protected abstract string ValuePropertyId { get; } 61 54 protected abstract string MinRangePropertyId { get; } … … 72 65 73 66 protected void Init() { 74 TBValue.DataBindings.Add("Text", VM, ValuePropertyId);67 TBValue.DataBindings.Add("Text", base.VM, ValuePropertyId); 75 68 NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, MinRangePropertyId); 76 69 NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, MaxRangePropertyId);
Note: See TracChangeset
for help on using the changeset viewer.