Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/12 16:36:26 (11 years ago)
Author:
sforsten
Message:

#1992: itemsGroupBox.Text displays the number of checked items. It is changed every time the content is changed or the checked items change.

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

Legend:

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

    r7259 r9026  
    2020#endregion
    2121
     22using System;
    2223using System.Drawing;
     24using System.Linq;
    2325using System.Windows.Forms;
    2426using HeuristicLab.Collections;
     
    3840      : base() {
    3941      InitializeComponent();
     42    }
     43
     44    protected override void OnContentChanged() {
     45      base.OnContentChanged();
     46      if (Content != null) {
     47        SetNumberOfCheckItems();
     48      }
    4049    }
    4150
     
    98107          }
    99108        }
     109        SetNumberOfCheckItems();
    100110      }
    101111    }
    102112    #endregion
     113
     114    private void SetNumberOfCheckItems() {
     115      this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     116    }
    103117  }
    104118}
  • trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemListView.cs

    r7259 r9026  
    2020#endregion
    2121
     22using System;
     23using System.Drawing;
    2224using System.Linq;
    23 using System.Drawing;
    2425using System.Windows.Forms;
    2526using HeuristicLab.Collections;
     
    5152      Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CheckedItemsChanged);
    5253      base.DeregisterContentEvents();
     54    }
     55
     56    protected override void OnContentChanged() {
     57      base.OnContentChanged();
     58      if (Content != null) {
     59        SetNumberOfCheckItems();
     60      }
    5361    }
    5462
     
    133141            itemsListView.Items[item.Index].Checked = Content.ItemChecked(item.Value);
    134142        }
     143        SetNumberOfCheckItems();
    135144      }
    136145    }
    137146    #endregion
     147
     148    private void SetNumberOfCheckItems() {
     149      this.itemsGroupBox.Text = String.Format("Items (Checked: {0}/{1})", Content.CheckedItems.Count(), Content.Count);
     150    }
    138151  }
    139152}
Note: See TracChangeset for help on using the changeset viewer.