Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9134


Ignore:
Timestamp:
01/09/13 14:59:22 (12 years ago)
Author:
sforsten
Message:

#1992: number of checked items also gets now updated when items are added, removed, moved, replaced or when the content is reset

Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs

    r9026 r9134  
    110110      }
    111111    }
     112    protected override void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<T> e) {
     113      base.Content_CollectionReset(sender, e);
     114      SetNumberOfCheckItems();
     115    }
     116    protected override void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) {
     117      base.Content_ItemsAdded(sender, e);
     118      SetNumberOfCheckItems();
     119    }
     120    protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<T> e) {
     121      base.Content_ItemsRemoved(sender, e);
     122      SetNumberOfCheckItems();
     123    }
    112124    #endregion
    113125
    114126    private void SetNumberOfCheckItems() {
    115       this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     127      if (InvokeRequired) {
     128        Invoke((Action)SetNumberOfCheckItems);
     129      } else {
     130        this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     131      }
    116132    }
    117133  }
  • trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemListView.cs

    r9026 r9134  
    144144      }
    145145    }
     146    protected override void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     147      base.Content_CollectionReset(sender, e);
     148      SetNumberOfCheckItems();
     149    }
     150    protected override void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     151      base.Content_ItemsAdded(sender, e);
     152      SetNumberOfCheckItems();
     153    }
     154    protected override void Content_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     155      base.Content_ItemsMoved(sender, e);
     156      SetNumberOfCheckItems();
     157    }
     158    protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     159      base.Content_ItemsRemoved(sender, e);
     160      SetNumberOfCheckItems();
     161    }
     162    protected override void Content_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     163      base.Content_ItemsReplaced(sender, e);
     164      SetNumberOfCheckItems();
     165    }
    146166    #endregion
    147167
    148168    private void SetNumberOfCheckItems() {
    149       this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     169      if (InvokeRequired) {
     170        Invoke((Action)SetNumberOfCheckItems);
     171      } else {
     172        this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     173      }
    150174    }
    151175  }
Note: See TracChangeset for help on using the changeset viewer.