Changeset 12631 for trunk/sources/HeuristicLab.Analysis.Statistics.Views
- Timestamp:
- 07/07/15 11:05:07 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs
r12599 r12631 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Threading; 25 26 using System.Threading.Tasks; 26 27 using System.Windows.Forms; … … 52 53 private bool valuesAdded = false; 53 54 private bool suppressUpdates = false; 55 private SemaphoreSlim sem = new SemaphoreSlim(1, 1); 54 56 55 57 public ChartAnalysisView() { … … 119 121 if (InvokeRequired) Invoke((Action<object, EventArgs>)Content_ColumnsChanged, sender, e); 120 122 else { 123 UpdateDataTableComboBox(); 121 124 RebuildDataTableAsync(); 122 125 } … … 138 141 139 142 if (!suppressUpdates && !valuesAdded) { 143 UpdateDataTableComboBox(); 140 144 RebuildDataTableAsync(); 141 145 } … … 164 168 165 169 private void dataRowComboBox_SelectedIndexChanged(object sender, EventArgs e) { 170 if (suppressUpdates) return; 166 171 RebuildDataTableAsync(); 167 172 } … … 266 271 string rowName = (string)dataRowComboBox.SelectedItem; 267 272 268 progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values..."); 269 var task = Task.Factory.StartNew(() => RebuildDataTable(resultName, rowName)); 273 var task = Task.Factory.StartNew(() => { 274 sem.Wait(); 275 progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values..."); 276 RebuildDataTable(resultName, rowName); 277 }); 270 278 271 279 task.ContinueWith((t) => { 272 280 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 273 281 ErrorHandling.ShowErrorDialog("An error occured while calculating values. ", t.Exception); 282 sem.Release(); 274 283 }, TaskContinuationOptions.OnlyOnFaulted); 275 284 276 285 task.ContinueWith((t) => { 277 286 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 287 sem.Release(); 278 288 }, TaskContinuationOptions.OnlyOnRanToCompletion); 279 289 }
Note: See TracChangeset
for help on using the changeset viewer.