Changeset 13534 for trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
- Timestamp:
- 01/17/16 20:06:18 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r12012 r13534 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using System.Windows.Forms; 26 using HeuristicLab.Common.Resources; 25 27 using HeuristicLab.Core.Views; 28 using HeuristicLab.Data; 26 29 using HeuristicLab.MainForm; 27 30 … … 38 41 public OKBProblemView() { 39 42 InitializeComponent(); 43 downloadCharacteristicsButton.Text = string.Empty; 44 downloadCharacteristicsButton.Image = VSImageLibrary.Refresh; 45 uploadCharacteristicsButton.Text = string.Empty; 46 uploadCharacteristicsButton.Image = VSImageLibrary.PublishToWeb; 40 47 } 41 48 … … 73 80 refreshButton.Enabled = (Content != null) && !ReadOnly && !Locked; 74 81 parameterCollectionView.Enabled = Content != null; 82 characteristicsMatrixView.Enabled = Content != null; 83 downloadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked; 84 uploadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly 85 && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0; 75 86 } 76 87 … … 103 114 if (InvokeRequired) 104 115 Invoke(new EventHandler(Content_ProblemChanged), sender, e); 105 else 116 else { 106 117 OnContentChanged(); 118 SetEnabledStateOfControls(); 119 } 107 120 } 108 121 #endregion … … 123 136 } 124 137 } 138 private void downloadCharacteristicsButton_Click(object sender, EventArgs e) { 139 var values = RunCreationClient.GetCharacteristicValues(Content.ProblemId).ToList(); 140 var content = new StringMatrix(values.Count, 3); 141 for (var i = 0; i < values.Count; i++) { 142 content[i, 0] = values[i].Name; 143 content[i, 1] = values[i].ToString(); 144 content[i, 2] = values[i].GetType().Name; 145 } 146 characteristicsMatrixView.Content = content; 147 SetEnabledStateOfControls(); 148 } 149 private void uploadCharacteristicsButton_Click(object sender, EventArgs e) { 150 var matrix = characteristicsMatrixView.Content as StringMatrix; 151 if (matrix == null) return; 152 var values = new List<Value>(matrix.Rows); 153 for (var i = 0; i < matrix.Rows; i++) { 154 var name = matrix[i, 0]; 155 var strValue = matrix[i, 1]; 156 var type = matrix[i, 2]; 157 values.Add(Value.Create(name, strValue, type)); 158 } 159 try { 160 RunCreationClient.SetCharacteristicValues(Content.ProblemId, values); 161 } catch (Exception ex) { PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); } 162 } 125 163 #endregion 126 164
Note: See TracChangeset
for help on using the changeset viewer.