Changeset 12284


Ignore:
Timestamp:
04/02/15 18:02:18 (4 years ago)
Author:
mkommend
Message:

#2025: Minor code improvements in new item dialog.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r12246 r12284  
    3333    private bool isInitialized;
    3434
    35     private List<TreeNode> treeNodes;
     35    private readonly List<TreeNode> treeNodes;
    3636    private string currentSearchString;
    3737
     
    100100        var parents = tokens.Take(tokens.Length - 1);
    101101
    102         var categoryNode = new TreeNode(name, 1, 1) {
     102        var categoryNode = new TreeNode(name, imageIndex: 1, selectedImageIndex: 1) {
    103103          Name = fullName,
    104104          Tag = fullName
     
    121121        parentNode = node.Nodes.Find(fullName, searchAllChildren: false).SingleOrDefault();
    122122        if (parentNode == null) {
    123           parentNode = new TreeNode(parentCategory, 1, 1) {
     123          parentNode = new TreeNode(parentCategory, imageIndex: 1, selectedImageIndex: 1) {
    124124            Name = fullName,
    125125            Tag = fullName
     
    229229        }
    230230        return node.Nodes.Count == 0;
    231       }
    232       if (node.Tag is Type) { // Type node
     231      } if (node.Tag is Type) { // Type node
    233232        var text = node.Text;
    234233        if (searchTokens.Any(searchToken => !text.ToLower().Contains(searchToken))) {
    235234          var typeTag = (Type)node.Tag;
    236           if (typeTag.Equals(SelectedType)) {
     235          if (typeTag == SelectedType) {
    237236            SelectedType = null;
    238237            typesTreeView.SelectedNode = null;
     
    242241        return false;
    243242      }
    244       return true;
     243      throw new InvalidOperationException("Encountered neither a category nor a creatable node during tree traversal.");
    245244    }
    246245
Note: See TracChangeset for help on using the changeset viewer.