Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9923


Ignore:
Timestamp:
09/02/13 14:03:42 (9 years ago)
Author:
ascheibe
Message:

#2031 fixed cross threading errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs

    r9922 r9923  
    241241        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>()
    242242          .AddOperationProgressToView(this, "Calculating...");
    243         Task.Factory.StartNew(CalculateValuesAsync);
    244       }
    245     }
    246 
    247     private void CalculateValuesAsync() {
     243
     244        string curItem = (string)groupCompComboBox.SelectedItem;
     245        Task.Factory.StartNew(() => CalculateValuesAsync(curItem));
     246      }
     247    }
     248
     249    private void CalculateValuesAsync(string groupName) {
    248250      TestAllGroups();
    249251      CalculateNormality();
    250252      CalculateNormalityDetails();
    251       CalculatePairwiseTest();
    252       CalculatePairwiseTestDetails();
     253      CalculatePairwiseTest(groupName);
     254      CalculatePairwiseTestDetails(groupName);
    253255
    254256      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
    255257    }
    256258
    257     private void CalculatePairwise() {
     259    private void CalculatePairwise(string groupName) {
    258260      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating...");
    259       Task.Factory.StartNew(CalculatePairwiseAsync);
    260     }
    261 
    262     private void CalculatePairwiseAsync() {
    263       CalculatePairwiseTest();
    264       CalculatePairwiseTestDetails();
     261      Task.Factory.StartNew(() => CalculatePairwiseAsync(groupName));
     262    }
     263
     264    private void CalculatePairwiseAsync(string groupName) {
     265      CalculatePairwiseTest(groupName);
     266      CalculatePairwiseTestDetails(groupName);
    265267
    266268      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
     
    309311    }
    310312
    311     private void CalculatePairwiseTest() {
    312       string curItem = (string)groupCompComboBox.SelectedItem;
     313    private void CalculatePairwiseTest(string groupName) {
    313314      int colIndex = 0;
    314 
    315       foreach (string col in stringConvertibleMatrixView.Content.ColumnNames) {
    316         if (col == curItem) {
     315      IEnumerable<string> columnNames = null;
     316      this.Invoke(new Action(() => { columnNames = stringConvertibleMatrixView.Content.ColumnNames; }));
     317
     318      foreach (string col in columnNames) {
     319        if (col == groupName) {
    317320          break;
    318321        }
     
    344347    }
    345348
    346     private void CalculatePairwiseTestDetails() {
    347       string curItem = (string)groupCompComboBox.SelectedItem;
     349    private void CalculatePairwiseTestDetails(string groupName) {
    348350      int colIndex = 0;
    349 
    350       foreach (string col in stringConvertibleMatrixView.Content.ColumnNames) {
    351         if (col == curItem) {
     351      IEnumerable<string> columnNames = null;
     352      this.Invoke(new Action(() => { columnNames = stringConvertibleMatrixView.Content.ColumnNames; }));
     353
     354      foreach (string col in columnNames) {
     355        if (col == groupName) {
    352356          break;
    353357        }
     
    386390
    387391    private void groupCompComboBox_SelectedValueChanged(object sender, EventArgs e) {
    388       CalculatePairwise();
     392      string curItem = (string)groupCompComboBox.SelectedItem;
     393      CalculatePairwise(curItem);
    389394    }
    390395  }
Note: See TracChangeset for help on using the changeset viewer.