Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/15 11:05:07 (9 years ago)
Author:
ascheibe
Message:

#2270 added refresh of data table combobox for the chart analysis and aggregation view

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Statistics.Views/3.3/ChartAnalysisView.cs

    r12599 r12631  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using System.Threading;
    2526using System.Threading.Tasks;
    2627using System.Windows.Forms;
     
    5253    private bool valuesAdded = false;
    5354    private bool suppressUpdates = false;
     55    private SemaphoreSlim sem = new SemaphoreSlim(1, 1);
    5456
    5557    public ChartAnalysisView() {
     
    119121      if (InvokeRequired) Invoke((Action<object, EventArgs>)Content_ColumnsChanged, sender, e);
    120122      else {
     123        UpdateDataTableComboBox();
    121124        RebuildDataTableAsync();
    122125      }
     
    138141
    139142        if (!suppressUpdates && !valuesAdded) {
     143          UpdateDataTableComboBox();
    140144          RebuildDataTableAsync();
    141145        }
     
    164168
    165169    private void dataRowComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     170      if (suppressUpdates) return;
    166171      RebuildDataTableAsync();
    167172    }
     
    266271      string rowName = (string)dataRowComboBox.SelectedItem;
    267272
    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      });
    270278
    271279      task.ContinueWith((t) => {
    272280        MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    273281        ErrorHandling.ShowErrorDialog("An error occured while calculating values. ", t.Exception);
     282        sem.Release();
    274283      }, TaskContinuationOptions.OnlyOnFaulted);
    275284
    276285      task.ContinueWith((t) => {
    277286        MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     287        sem.Release();
    278288      }, TaskContinuationOptions.OnlyOnRanToCompletion);
    279289    }
Note: See TracChangeset for help on using the changeset viewer.