Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5239 for trunk


Ignore:
Timestamp:
01/08/11 02:34:26 (14 years ago)
Author:
swagner
Message:

Adapted method RebuildImageList to work with null items (#1324)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r5238 r5239  
    441441      }
    442442    }
    443     private void RebuildImageList() {
     443    protected virtual void RebuildImageList() {
    444444      itemsListView.SmallImageList.Images.Clear();
    445       foreach (ListViewItem item in itemsListView.Items) {
    446         itemsListView.SmallImageList.Images.Add(((T)item.Tag).ItemImage);
    447         item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     445      foreach (ListViewItem listViewItem in itemsListView.Items) {
     446        T item = listViewItem.Tag as T;
     447        itemsListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VS2008ImageLibrary.Nothing : item.ItemImage);
     448        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
    448449      }
    449450    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r5237 r5239  
    379379      }
    380380    }
    381     private void RebuildImageList() {
     381    protected virtual void RebuildImageList() {
    382382      itemsListView.SmallImageList.Images.Clear();
    383       foreach (ListViewItem item in itemsListView.Items) {
    384         itemsListView.SmallImageList.Images.Add(((T)item.Tag).ItemImage);
    385         item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     383      foreach (ListViewItem listViewItem in itemsListView.Items) {
     384        T item = listViewItem.Tag as T;
     385        itemsListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VS2008ImageLibrary.Nothing : item.ItemImage);
     386        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
    386387      }
    387388    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r5238 r5239  
    458458      }
    459459    }
    460     private void RebuildImageList() {
     460    protected virtual void RebuildImageList() {
    461461      itemsListView.SmallImageList.Images.Clear();
    462       foreach (ListViewItem item in itemsListView.Items) {
    463         itemsListView.SmallImageList.Images.Add(((T)item.Tag).ItemImage);
    464         item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     462      foreach (ListViewItem listViewItem in itemsListView.Items) {
     463        T item = listViewItem.Tag as T;
     464        itemsListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VS2008ImageLibrary.Nothing : item.ItemImage);
     465        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
    465466      }
    466467    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r5237 r5239  
    430430    private void RebuildImageList() {
    431431      itemsListView.SmallImageList.Images.Clear();
    432       foreach (ListViewItem item in itemsListView.Items) {
    433         itemsListView.SmallImageList.Images.Add(((IRun)item.Tag).ItemImage);
    434         item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     432      foreach (ListViewItem listViewItem in itemsListView.Items) {
     433        IRun item = listViewItem.Tag as IRun;
     434        itemsListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VS2008ImageLibrary.Nothing : item.ItemImage);
     435        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
    435436      }
    436437    }
Note: See TracChangeset for help on using the changeset viewer.