Changeset 15055 for stable/HeuristicLab.Clients.OKB.Views/3.3/Query
- Timestamp:
- 06/25/17 15:22:47 (7 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13474
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/QueryView.cs
r14186 r15055 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.IO;26 25 using System.Linq; 27 26 using System.Threading; 28 27 using System.Threading.Tasks; 29 28 using System.Windows.Forms; 30 using HeuristicLab.Core;31 29 using HeuristicLab.MainForm; 32 30 using HeuristicLab.MainForm.WindowsForms; 33 31 using HeuristicLab.Optimization; 34 using HeuristicLab.Persistence.Default.Xml;35 32 using HeuristicLab.PluginInfrastructure; 36 33 … … 103 100 cancellationToken.ThrowIfCancellationRequested(); 104 101 if (AllValueNamesChecked()) { 105 runs.AddRange(QueryClient.Instance.GetRuns(ids.Take(batchSize), includeBinaryValues).Select(x => ConvertToOptimizationRun(x)));102 runs.AddRange(QueryClient.Instance.GetRuns(ids.Take(batchSize), includeBinaryValues).Select(x => QueryClient.Instance.ConvertToOptimizationRun(x))); 106 103 } else { 107 runs.AddRange(QueryClient.Instance.GetRunsWithValues(ids.Take(batchSize), includeBinaryValues, valueNames).Select(x => ConvertToOptimizationRun(x)));104 runs.AddRange(QueryClient.Instance.GetRunsWithValues(ids.Take(batchSize), includeBinaryValues, valueNames).Select(x => QueryClient.Instance.ConvertToOptimizationRun(x))); 108 105 } 109 106 ids = ids.Skip(batchSize); … … 124 121 try { 125 122 t.Wait(); 126 } 127 catch (AggregateException ex) { 123 } catch (AggregateException ex) { 128 124 try { 129 125 ex.Flatten().Handle(x => x is OperationCanceledException); 130 } 131 catch (AggregateException remaining) { 126 } catch (AggregateException remaining) { 132 127 if (remaining.InnerExceptions.Count == 1) ErrorHandling.ShowErrorDialog(this, "Refresh results failed.", remaining.InnerExceptions[0]); 133 128 else ErrorHandling.ShowErrorDialog(this, "Refresh results failed.", remaining); … … 195 190 } 196 191 197 private Optimization.IRun ConvertToOptimizationRun(Run run) {198 Optimization.Run optRun = new Optimization.Run();199 foreach (Value value in run.ParameterValues)200 optRun.Parameters.Add(value.Name, ConvertToItem(value));201 foreach (Value value in run.ResultValues)202 optRun.Results.Add(value.Name, ConvertToItem(value));203 return optRun;204 }205 206 private IItem ConvertToItem(Value value) {207 if (value is BinaryValue) {208 IItem item = null;209 BinaryValue binaryValue = (BinaryValue)value;210 if (binaryValue.Value != null) {211 using (MemoryStream stream = new MemoryStream(binaryValue.Value)) {212 try {213 item = XmlParser.Deserialize<IItem>(stream);214 }215 catch (Exception) { }216 stream.Close();217 }218 }219 return item != null ? item : new Data.StringValue(value.DataType.Name);220 } else if (value is BoolValue) {221 return new Data.BoolValue(((BoolValue)value).Value);222 } else if (value is FloatValue) {223 return new Data.DoubleValue(((FloatValue)value).Value);224 } else if (value is PercentValue) {225 return new Data.PercentValue(((PercentValue)value).Value);226 } else if (value is DoubleValue) {227 return new Data.DoubleValue(((DoubleValue)value).Value);228 } else if (value is IntValue) {229 return new Data.IntValue((int)((IntValue)value).Value);230 } else if (value is LongValue) {231 return new Data.IntValue((int)((LongValue)value).Value);232 } else if (value is StringValue) {233 return new Data.StringValue(((StringValue)value).Value);234 } else if (value is TimeSpanValue) {235 return new Data.TimeSpanValue(TimeSpan.FromSeconds((long)((TimeSpanValue)value).Value));236 }237 return null;238 }239 240 192 private void SetCheckedState(bool val) { 241 193 for (int i = 0; i < constraintsCheckedListBox.Items.Count; i++) {
Note: See TracChangeset
for help on using the changeset viewer.