Changeset 4944
- Timestamp:
- 11/26/10 13:27:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/RunCollectionVariableImpactView.cs
r4385 r4944 33 33 [Content(typeof(RunCollection), false)] 34 34 [View("RunCollection Variable Impact View")] 35 public partial class RunCollectionVariableImpactView : AsynchronousContentView {35 public sealed partial class RunCollectionVariableImpactView : AsynchronousContentView { 36 36 private const string variableImpactResultName = "Integrated variable frequencies"; 37 37 public RunCollectionVariableImpactView() { … … 44 44 } 45 45 46 #region events 46 47 protected override void RegisterContentEvents() { 47 48 base.RegisterContentEvents(); 48 this.Content.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded); 49 this.Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 50 this.Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 49 Content.UpdateOfRunsInProgressChanged += new EventHandler(Content_UpdateOfRunsInProgressChanged); 50 Content.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded); 51 Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 52 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 53 RegisterRunEvents(Content); 51 54 } 52 55 protected override void DeregisterContentEvents() { 53 56 base.RegisterContentEvents(); 54 this.Content.ItemsAdded -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded); 55 this.Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 56 this.Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 57 } 57 Content.UpdateOfRunsInProgressChanged -= new EventHandler(Content_UpdateOfRunsInProgressChanged); 58 Content.ItemsAdded -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded); 59 Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved); 60 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 61 DeregisterRunEvents(Content); 62 } 63 private void RegisterRunEvents(IEnumerable<IRun> runs) { 64 foreach (IRun run in runs) 65 run.Changed += new EventHandler(Run_Changed); 66 } 67 private void DeregisterRunEvents(IEnumerable<IRun> runs) { 68 foreach (IRun run in runs) 69 run.Changed -= new EventHandler(Run_Changed); 70 } 71 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 72 RegisterRunEvents(e.Items); 73 UpdateData(); 74 } 75 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 76 DeregisterRunEvents(e.Items); 77 UpdateData(); 78 } 79 private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 80 DeregisterRunEvents(e.OldItems); 81 RegisterRunEvents(e.Items); 82 UpdateData(); 83 } 84 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 85 if (!Content.UpdateOfRunsInProgress) UpdateData(); 86 } 87 private void Run_Changed(object sender, EventArgs e) { 88 if (!Content.UpdateOfRunsInProgress) UpdateData(); 89 } 90 #endregion 58 91 59 92 protected override void OnContentChanged() { 60 93 base.OnContentChanged(); 61 this.UpdateData();62 }63 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {64 this.UpdateData();65 }66 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {67 this.UpdateData();68 }69 private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {70 94 this.UpdateData(); 71 95 }
Note: See TracChangeset
for help on using the changeset viewer.