Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/27/12 17:59:55 (12 years ago)
Author:
sforsten
Message:

#1292:

  • BackgroundWorker is now reused in FeatureCorrelation
  • renamed some variables
  • ComboBoxes are now DropDownLists
  • FeatureCorrelation doesn't calculate the elements in the constructor anymore
  • small changes in the views
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/FeatureCorrelation.cs

    r8492 r8529  
    6565
    6666    private BackgroundWorker bw;
     67    private BackgroundWorkerInfo bwInfo;
    6768
    6869    public FeatureCorrelation()
     
    8081      this.rowNames = problemData.Dataset.DoubleVariables.ToList();
    8182      sortableView = true;
    82 
    83       CalculateElements(problemData.Dataset);
    8483    }
    8584    protected FeatureCorrelation(FeatureCorrelation original, Cloner cloner)
     
    107106
    108107    private void CalculateElements(Dataset dataset, string calc, string partition, string variable = null, int frames = 0) {
    109       if (bw == null || bw.IsBusy) {
    110         if (bw != null) {
    111           bw.CancelAsync();
    112         }
     108      bwInfo = new BackgroundWorkerInfo { Dataset = dataset, Calculator = calc, Partition = partition, Variable = variable, Frames = frames };
     109      if (bw == null) {
    113110        bw = new BackgroundWorker();
    114111        bw.WorkerReportsProgress = true;
     
    118115        bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BwRunWorkerCompleted);
    119116      }
    120       bw.RunWorkerAsync(new BackgroundWorkerInfo { Dataset = dataset, Calculator = calc, Partition = partition, Variable = variable, Frames = frames });
     117      if (bw.IsBusy) {
     118        bw.CancelAsync();
     119      } else {
     120        bw.RunWorkerAsync(bwInfo);
     121      }
    121122      if (calc.Equals(PearsonsR) || calc.Equals(SpearmansRank)) {
    122123        Maximum = 1.0;
     
    256257          OnCorrelationCalculationFinished();
    257258        }
     259      } else {
     260        bw.RunWorkerAsync(bwInfo);
    258261      }
    259262    }
Note: See TracChangeset for help on using the changeset viewer.