Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13181


Ignore:
Timestamp:
11/16/15 16:48:32 (9 years ago)
Author:
abeham
Message:

#2441: Fixed bug with aggregation view open while runs are being added

This also fixes a bug I noticed in that after every add to a RunCollection the batch update event was triggered. I had put that in FilterRuns which was called from multiple places.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionChartAggregationView.cs

    r12692 r13181  
    8080        return;
    8181      }
     82      UpdateDataTableComboBox(); // will trigger AddRuns
     83    }
     84    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     85      if (suppressUpdates) return;
     86      if (InvokeRequired) {
     87        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e);
     88        return;
     89      }
     90      RemoveRuns(e.Items);
    8291      UpdateDataTableComboBox();
    8392      UpdateDataRowComboBox();
    84       AddRuns(e.Items);
    85     }
    86     private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    87       if (suppressUpdates) return;
    88       if (InvokeRequired) {
    89         Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e);
    90         return;
    91       }
     93      RebuildCombinedDataTable();
     94    }
     95    private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
     96      if (suppressUpdates) return;
     97      if (InvokeRequired) {
     98        Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e);
     99        return;
     100      }
     101      RemoveRuns(e.OldItems);
    92102      UpdateDataTableComboBox();
    93103      UpdateDataRowComboBox();
    94       RemoveRuns(e.Items);
    95     }
    96     private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    97       if (suppressUpdates) return;
    98       if (InvokeRequired) {
    99         Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e);
    100         return;
    101       }
    102       UpdateDataTableComboBox();
    103       UpdateDataRowComboBox();
    104       RemoveRuns(e.OldItems);
    105       AddRuns(e.Items);
     104      RebuildCombinedDataTable();
    106105    }
    107106    private void Content_AlgorithmNameChanged(object sender, EventArgs e) {
     
    117116      suppressUpdates = Content.UpdateOfRunsInProgress;
    118117      if (!suppressUpdates) {
     118        foreach (var run in runMapping)
     119          DeregisterRunEvents(run.Key);
     120        runMapping.Clear();
     121        combinedDataTable.Rows.Clear();
    119122        UpdateDataTableComboBox();
    120         UpdateDataRowComboBox();
    121         UpdateRuns(Content);
    122123      }
    123124    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionView.cs

    r12692 r13181  
    389389        return;
    390390      ReadOnly = true;
     391
    391392      try {
     393        RunCollection.UpdateOfRunsInProgress = true;
    392394        RunCollection.Modify();
    393395      } finally {
    394396        ReadOnly = false;
     397        RunCollection.UpdateOfRunsInProgress = false;
    395398      }
    396399    }
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r12692 r13181  
    483483    #region Filtering
    484484    private void UpdateFiltering(bool reset) {
    485       var oldUpateRuns = UpdateOfRunsInProgress;
    486       UpdateOfRunsInProgress = true;
    487485      if (reset)
    488486        list.ForEach(r => r.Visible = true);
    489487      foreach (IRunCollectionConstraint constraint in this.constraints)
    490488        constraint.Check();
    491       UpdateOfRunsInProgress = oldUpateRuns;
    492489    }
    493490
     
    539536    protected virtual void Constraint_ConstraintOperationChanged(object sender, EventArgs e) {
    540537      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
    541       if (constraint.Active)
    542         this.UpdateFiltering(true);
     538      if (constraint.Active) {
     539        var oldUpateRuns = UpdateOfRunsInProgress;
     540        try {
     541          UpdateOfRunsInProgress = true;
     542          UpdateFiltering(true);
     543        } finally { UpdateOfRunsInProgress = oldUpateRuns; }
     544      }
    543545    }
    544546    protected virtual void Constraint_ConstraintDataChanged(object sender, EventArgs e) {
    545547      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
    546       if (constraint.Active)
    547         this.UpdateFiltering(true);
     548      if (constraint.Active) {
     549        var oldUpateRuns = UpdateOfRunsInProgress;
     550        try {
     551          UpdateOfRunsInProgress = true;
     552          UpdateFiltering(true);
     553        } finally { UpdateOfRunsInProgress = oldUpateRuns; }
     554      }
    548555    }
    549556    #endregion
     
    551558    #region Modification
    552559    public void Modify() {
    553       var oldUpateRuns = UpdateOfRunsInProgress;
    554       UpdateOfRunsInProgress = true;
    555560      var runs = this.ToList();
    556561      var selectedRuns = runs.Where(r => r.Visible).ToList();
     
    566571        }
    567572      }
    568       UpdateOfRunsInProgress = oldUpateRuns;
    569573    }
    570574
Note: See TracChangeset for help on using the changeset viewer.