Changeset 6539


Ignore:
Timestamp:
07/07/11 15:39:57 (10 years ago)
Author:
mkommend
Message:

#1555: Optimized rebuilding of the image list due to performance reasons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs

    r6531 r6539  
    848848      }
    849849
     850      treeView.BeginUpdate();
     851
    850852      treeView.ImageList.Images.Clear();
    851       foreach (TreeNode treeNode in IterateTreeNodes()) {
     853      var topLevelNodes = treeView.Nodes.OfType<TreeNode>().ToArray();
     854      var nodes = IterateTreeNodes().ToList();
     855      treeView.Nodes.Clear();
     856
     857      foreach (TreeNode treeNode in nodes) {
    852858        var item = (IItem)treeNode.Tag;
    853859        treeView.ImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage);
    854860        treeNode.ImageIndex = treeView.ImageList.Images.Count - 1;
    855         treeNode.SelectedImageIndex = treeNode.ImageIndex;
    856       }
     861      }
     862      treeView.Nodes.AddRange(topLevelNodes);
     863      treeView.EndUpdate();
    857864    }
    858865    #endregion
Note: See TracChangeset for help on using the changeset viewer.