Changeset 3449 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 04/20/10 18:19:03 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r3448 r3449 119 119 } 120 120 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 121 DeregisterRunEvents(e. OldItems);121 DeregisterRunEvents(e.Items); 122 122 } 123 123 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs
r3448 r3449 86 86 } 87 87 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 88 DeregisterRunEvents(e. OldItems);88 DeregisterRunEvents(e.Items); 89 89 } 90 90 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r3435 r3449 27 27 using System.Windows.Forms; 28 28 using System; 29 using System.Drawing; 29 30 using System.Collections.Generic; 30 31 … … 57 58 Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 58 59 Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 60 DeregisterRunEvents(Content); 59 61 base.DeregisterContentEvents(); 60 62 } … … 64 66 Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 65 67 Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 68 RegisterRunEvents(Content); 69 } 70 protected virtual void RegisterRunEvents(IEnumerable<IRun> runs) { 71 foreach (IRun run in runs) 72 run.Changed += new EventHandler(run_Changed); 73 } 74 protected virtual void DeregisterRunEvents(IEnumerable<IRun> runs) { 75 foreach (IRun run in runs) 76 run.Changed -= new EventHandler(run_Changed); 66 77 } 67 78 … … 78 89 } 79 90 SetEnabledStateOfControls(); 91 } 92 93 private void run_Changed(object sender, EventArgs e) { 94 IRun run = (IRun)sender; 95 foreach (ListViewItem listViewItem in GetListViewItemsForItem(run)) { 96 if (run.Visible) { 97 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular); 98 listViewItem.ForeColor = run.Color; 99 } else { 100 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Italic); 101 listViewItem.ForeColor = Color.LightGray; 102 } 103 } 80 104 } 81 105 … … 224 248 if (InvokeRequired) 225 249 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded), sender, e); 226 else 250 else { 251 RegisterRunEvents(e.Items); 227 252 foreach (IRun item in e.Items) 228 253 AddListViewItem(CreateListViewItem(item)); 254 } 229 255 } 230 256 protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { … … 232 258 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved), sender, e); 233 259 else { 260 DeregisterRunEvents(e.Items); 234 261 foreach (IRun item in e.Items) { 235 262 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { … … 244 271 Invoke(new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset), sender, e); 245 272 else { 273 DeregisterRunEvents(e.OldItems); 246 274 foreach (IRun item in e.OldItems) { 247 275 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { … … 250 278 } 251 279 } 280 RegisterRunEvents(e.Items); 252 281 foreach (IRun item in e.Items) 253 282 AddListViewItem(CreateListViewItem(item));
Note: See TracChangeset
for help on using the changeset viewer.