- Timestamp:
- 01/19/16 08:38:56 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs
r13540 r13550 216 216 this.calculatorListView.UseCompatibleStateImageBehavior = false; 217 217 this.calculatorListView.View = System.Windows.Forms.View.Details; 218 this.calculatorListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.calculatorListView_ItemChecked); 218 219 // 219 220 // characteristicColumnHeader -
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r13540 r13550 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Globalization;25 24 using System.Linq; 26 25 using System.Windows.Forms; … … 92 91 uploadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly 93 92 && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0; 93 calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly && calculatorListView.CheckedItems.Count > 0; 94 94 } 95 95 … … 114 114 var item = calculatorListView.Items.Add(c, c); 115 115 item.Group = group; 116 item.Checked = true; 116 117 } 117 118 } … … 186 187 try { 187 188 RunCreationClient.SetCharacteristicValues(Content.ProblemId, values); 188 } catch (Exception ex) { PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); }189 } catch (Exception ex) { ErrorHandling.ShowErrorDialog(ex); } 189 190 } 190 191 private void calculateButton_Click(object sender, EventArgs e) { 192 var characteristics = calculatorListView.CheckedItems.OfType<ListViewItem>().GroupBy(x => x.Group).ToList(); 193 if (characteristics.Count == 0) return; 191 194 var problem = Content.CloneProblem(); 192 var characteristics = calculatorListView.CheckedItems.OfType<ListViewItem>().GroupBy(x => x.Group); 193 var results = new Dictionary<string, double>(); 195 var results = new Dictionary<string, Value>(); 194 196 foreach (var c in characteristics) { 195 197 var calc = (ICharacteristicCalculator)c.Key.Tag; 196 198 foreach (var result in calc.Calculate(problem, c.Select(x => x.Text).ToArray())) 197 results[result.Key] = result.Value; 198 } 199 var matrix = characteristicsMatrixView.Content as StringMatrix; 200 if (matrix == null) matrix = new StringMatrix(results.Count, 3); 199 results[result.Key] = RunCreationClient.Instance.ConvertToValue(result.Value, result.Key); 200 } 201 var matrix = (characteristicsMatrixView.Content as StringMatrix) ?? (new StringMatrix(results.Count, 3)); 201 202 for (var i = 0; i < matrix.Rows; i++) { 202 double r;203 Value r; 203 204 if (results.TryGetValue(matrix[i, 0], out r)) { 204 matrix[i, 1] = r. ToString(CultureInfo.CurrentCulture.NumberFormat);205 matrix[i, 2] = "DoubleValue";205 matrix[i, 1] = r.GetValue(); 206 matrix[i, 2] = r.GetType().Name; 206 207 results.Remove(matrix[i, 0]); 207 208 } … … 213 214 if (string.IsNullOrEmpty(matrix[i, 0])) { 214 215 matrix[i, 0] = resultsList[counter].Key; 215 matrix[i, 1] = resultsList[counter].Value. ToString(CultureInfo.CurrentCulture.NumberFormat);216 matrix[i, 2] = "DoubleValue";216 matrix[i, 1] = resultsList[counter].Value.GetValue(); 217 matrix[i, 2] = resultsList[counter].Value.GetType().Name; 217 218 resultsList.RemoveAt(counter); 218 219 counter--; … … 224 225 for (var i = matrix.Rows - 1; counter >= 0; i--) { 225 226 matrix[i, 0] = resultsList[0].Key; 226 matrix[i, 1] = resultsList[0].Value.ToString(CultureInfo.CurrentCulture.NumberFormat); 227 matrix[i, 2] = "DoubleValue"; 227 matrix[i, 1] = resultsList[0].Value.GetValue(); 228 matrix[i, 2] = resultsList[0].Value.GetType().Name; 229 resultsList.RemoveAt(0); 228 230 counter--; 229 231 } 230 232 } 233 SetEnabledStateOfControls(); 234 } 235 private void calculatorListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 236 SetEnabledStateOfControls(); 231 237 } 232 238 #endregion … … 239 245 } 240 246 #endregion 247 241 248 } 242 249 }
Note: See TracChangeset
for help on using the changeset viewer.