Changeset 5237 for trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.cs
- Timestamp:
- 01/08/11 01:47:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.cs
r4162 r5237 23 23 using System.Drawing; 24 24 using System.Windows.Forms; 25 using HeuristicLab.Collections;26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Core.Views; … … 60 59 protected override ListViewItem CreateListViewItem(IRunCollectionConstraint item) { 61 60 ListViewItem listViewItem = base.CreateListViewItem(item); 62 if (item.Active) 63 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold); 64 else 65 listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular); 61 if (item != null) { 62 listViewItem.Font = item.Active ? new Font(listViewItem.Font, FontStyle.Bold) : new Font(listViewItem.Font, FontStyle.Regular); 63 } 66 64 return listViewItem; 67 65 } 68 66 69 protected override void RegisterContentEvents() { 70 base.RegisterContentEvents(); 71 foreach (IRunCollectionConstraint constraint in Content) 72 RegisterConstraintEvents(constraint); 67 protected override void DeregisterItemEvents(IRunCollectionConstraint item) { 68 item.ActiveChanged -= new EventHandler(Item_ActiveChanged); 69 base.DeregisterItemEvents(item); 73 70 } 74 protected override void DeregisterContentEvents() { 75 base.DeregisterContentEvents(); 76 foreach (IRunCollectionConstraint constraint in Content) 77 DeregisterConstraintEvents(constraint); 78 } 79 protected override void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 80 base.Content_ItemsAdded(sender, e); 81 foreach (IRunCollectionConstraint constraint in e.Items) 82 RegisterConstraintEvents(constraint); 83 84 } 85 protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 86 base.Content_ItemsRemoved(sender, e); 87 foreach (IRunCollectionConstraint constraint in e.Items) 88 DeregisterConstraintEvents(constraint); 89 } 90 protected override void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) { 91 base.Content_CollectionReset(sender, e); 92 foreach (IRunCollectionConstraint constraint in e.OldItems) 93 RegisterConstraintEvents(constraint); 94 foreach (IRunCollectionConstraint constraint in e.Items) 95 DeregisterConstraintEvents(constraint); 71 protected override void RegisterItemEvents(IRunCollectionConstraint item) { 72 base.RegisterItemEvents(item); 73 item.ActiveChanged += new EventHandler(Item_ActiveChanged); 96 74 } 97 75 98 protected virtual void RegisterConstraintEvents(IRunCollectionConstraint constraint) { 99 constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged); 100 } 101 protected virtual void DeregisterConstraintEvents(IRunCollectionConstraint constraint) { 102 constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged); 103 } 104 protected virtual void constraint_ActiveChanged(object sender, EventArgs e) { 76 protected virtual void Item_ActiveChanged(object sender, EventArgs e) { 105 77 IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender; 106 78 foreach (ListViewItem listViewItem in GetListViewItemsForItem(constraint)) {
Note: See TracChangeset
for help on using the changeset viewer.