Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11379


Ignore:
Timestamp:
09/17/14 20:54:20 (10 years ago)
Author:
ascheibe
Message:

#2031 fixed some bugs

Location:
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
Files:
2 edited

Legend:

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

    r11378 r11379  
    8686
    8787    private void UpdateComboboxes() {
    88       dataTableComboBox.Items.Clear();
    89       dataRowComboBox.Items.Clear();
    90 
    9188      if (Content != null) {
    9289        UpdateDataTableComboBox();
     
    200197      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Adding fitted lines to charts...");
    201198
    202       var task = Task.Factory.StartNew(AddLineToChart);
     199      string resultName = (string)dataTableComboBox.SelectedItem;
     200      string rowName = (string)dataRowComboBox.SelectedItem;
     201
     202      var task = Task.Factory.StartNew(() => AddLineToChart(resultName, rowName));
    203203
    204204      task.ContinueWith((t) => {
     
    212212    }
    213213
    214     private void AddLineToChart() {
    215       string resultName = (string)dataTableComboBox.SelectedItem;
    216       string rowName = (string)dataRowComboBox.SelectedItem;
    217 
     214    private void AddLineToChart(string resultName, string rowName) {
    218215      foreach (IRun run in runs) {
    219216        DataTable resTable = (DataTable)run.Results[resultName];
     
    253250
    254251    private void UpdateDataRowComboBox() {
     252      string selectedItem = (string)this.dataRowComboBox.SelectedItem;
     253
    255254      dataRowComboBox.Items.Clear();
    256255      var resultName = (string)dataTableComboBox.SelectedItem;
     
    263262
    264263      dataRowComboBox.Items.AddRange(rowNames);
    265       if (dataRowComboBox.Items.Count > 0) dataRowComboBox.SelectedItem = dataRowComboBox.Items[0];
     264      if (selectedItem != null && dataRowComboBox.Items.Contains(selectedItem)) {
     265        dataRowComboBox.SelectedItem = selectedItem;
     266      } else if (dataRowComboBox.Items.Count > 0) {
     267        dataRowComboBox.SelectedItem = dataRowComboBox.Items[0];
     268      }
    266269    }
    267270
    268271    private void UpdateDataTableComboBox() {
     272      string selectedItem = (string)this.dataTableComboBox.SelectedItem;
     273
    269274      dataTableComboBox.Items.Clear();
    270275      var dataTables = (from run in Content
     
    274279
    275280      dataTableComboBox.Items.AddRange(dataTables);
    276       if (dataTableComboBox.Items.Count > 0) dataTableComboBox.SelectedItem = dataTableComboBox.Items[0];
     281      if (selectedItem != null && dataTableComboBox.Items.Contains(selectedItem)) {
     282        dataTableComboBox.SelectedItem = selectedItem;
     283      } else if (dataTableComboBox.Items.Count > 0) {
     284        dataTableComboBox.SelectedItem = dataTableComboBox.Items[0];
     285      }
    277286    }
    278287
     
    280289      progress = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating values...");
    281290
    282       var task = Task.Factory.StartNew(RebuildDataTable);
     291      string resultName = (string)dataTableComboBox.SelectedItem;
     292      string rowName = (string)dataRowComboBox.SelectedItem;
     293
     294      var task = Task.Factory.StartNew(() => RebuildDataTable(resultName, rowName));
    283295
    284296      task.ContinueWith((t) => {
     
    292304    }
    293305
    294     private void RebuildDataTable() {
    295       string resultName = (string)dataTableComboBox.SelectedItem;
    296       string rowName = (string)dataRowComboBox.SelectedItem;
     306    private void RebuildDataTable(string resultName, string rowName) {
    297307      LinearLeastSquaresFitting llsFitting = new LinearLeastSquaresFitting();
    298308      LogFitting logFitting = new LogFitting();
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs

    r11378 r11379  
    140140
    141141    private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     142      DeregisterRunEvents(e.OldItems);
     143      RegisterRunEvents(e.Items);
    142144      UpdateUI();
    143145    }
    144146
    145147    private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     148      DeregisterRunEvents(e.Items);
    146149      UpdateUI();
    147150    }
    148151
    149152    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     153      RegisterRunEvents(e.Items);
    150154      UpdateUI();
    151155    }
Note: See TracChangeset for help on using the changeset viewer.