Ignore:
Timestamp:
04/20/10 18:00:29 (11 years ago)
Author:
mkommend
Message:

added reaction of color & visibility of IRuns in RunCollectionTabularView (ticket #970)

File:
1 edited

Legend:

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

    r3447 r3448  
    9494      Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    9595      Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    96       foreach (IRun run in Content)
     96      RegisterRunEvents(Content);
     97    }
     98    protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) {
     99      foreach (IRun run in runs)
    97100        run.Changed += new EventHandler(run_Changed);
    98101    }
    99 
    100102    protected override void DeregisterContentEvents() {
    101103      base.DeregisterContentEvents();
     
    105107      Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    106108      Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    107       foreach (IRun run in Content)
     109      DeregisterRunEvents(Content);
     110    }
     111    protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) {
     112      foreach (IRun run in runs)
    108113        run.Changed -= new EventHandler(run_Changed);
    109114    }
    110115
    111116    private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    112       foreach (IRun run in e.OldItems)
    113         run.Changed -= new EventHandler(run_Changed);
    114       foreach (IRun run in e.Items)
    115         run.Changed += new EventHandler(run_Changed);
    116     }
    117 
     117      DeregisterRunEvents(e.OldItems);
     118      RegisterRunEvents(e.Items);
     119    }
    118120    private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    119       foreach (IRun run in e.OldItems)
    120         run.Changed -= new EventHandler(run_Changed);
     121      DeregisterRunEvents(e.OldItems);
    121122    }
    122123    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
    123       foreach (IRun run in e.Items)
    124         run.Changed += new EventHandler(run_Changed);
     124      RegisterRunEvents(e.Items);
    125125    }
    126126    private void run_Changed(object sender, EventArgs e) {
Note: See TracChangeset for help on using the changeset viewer.