Changeset 12200
- Timestamp:
- 03/16/15 09:30:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs
r12184 r12200 29 29 namespace HeuristicLab.Optimizer { 30 30 internal partial class NewItemDialog : Form { 31 private bool isInitialized; 32 31 33 private List<TreeNode> treeNodes; 32 34 private string currentSearchString; … … 58 60 59 61 private void NewItemDialog_Load(object sender, EventArgs e) { 62 if (isInitialized) return; 63 60 64 var categories = 61 65 from t in ApplicationManager.Manager.GetTypes(typeof(IItem)) … … 68 72 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Namespace); // plugins 69 73 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Interface); // interfacesitemsListView.SmallImageList = new ImageList(); 70 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Template); // generic types itemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class); // default icon74 imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Template); // generic types 71 75 72 76 foreach (var category in categories) { … … 105 109 foreach (var node in treeNodes) 106 110 typesTreeView.Nodes.Add((TreeNode)node.Clone()); 107 //for (int i = 0; i < itemsListView.Columns.Count; i++) 108 // itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 111 isInitialized = true; 109 112 } 110 113 … … 128 131 RestoreSelectedNode(selectedNode); 129 132 typesTreeView.EndUpdate(); 130 // remove nodes 131 typesTreeView.BeginUpdate(); 132 int i = 0; 133 while (i < typesTreeView.Nodes.Count) { 134 int j = 0; 135 while (j < typesTreeView.Nodes[i].Nodes.Count) { 136 if (!typesTreeView.Nodes[i].Nodes[j].Text.ToLower().Contains(searchString)) { 137 if ((typesTreeView.Nodes[i].Nodes[j].Tag as Type).Equals(SelectedType)) 138 SelectedType = null; 139 typesTreeView.Nodes[i].Nodes[j].Remove(); 140 } else 141 j++; 142 } 143 if (typesTreeView.Nodes[i].Nodes.Count == 0) 144 typesTreeView.Nodes[i].Remove(); 145 else 146 i++; 147 } 148 typesTreeView.EndUpdate(); 149 currentSearchString = searchString; 150 151 // if there is just one type node left, select by default 152 if (typesTreeView.Nodes.Count == 1) { 153 if (typesTreeView.Nodes[0].Nodes.Count == 1) { 154 typesTreeView.SelectedNode = typesTreeView.Nodes[0].Nodes[0]; 155 } 156 } 157 158 if (typesTreeView.Nodes.Count == 0) { 159 SelectedType = null; 160 typesTreeView.Enabled = false; 161 } else { 162 SetTreeNodeVisibility(); 163 typesTreeView.Enabled = true; 164 } 165 UpdateDescription(); 166 } 133 } 134 135 // remove nodes 136 typesTreeView.BeginUpdate(); 137 int i = 0; 138 while (i < typesTreeView.Nodes.Count) { 139 int j = 0; 140 while (j < typesTreeView.Nodes[i].Nodes.Count) { 141 if (!typesTreeView.Nodes[i].Nodes[j].Text.ToLower().Contains(searchString)) { 142 if ((typesTreeView.Nodes[i].Nodes[j].Tag as Type).Equals(SelectedType)) 143 SelectedType = null; 144 typesTreeView.Nodes[i].Nodes[j].Remove(); 145 } else 146 j++; 147 } 148 if (typesTreeView.Nodes[i].Nodes.Count == 0) 149 typesTreeView.Nodes[i].Remove(); 150 else 151 i++; 152 } 153 typesTreeView.EndUpdate(); 154 currentSearchString = searchString; 155 156 // if there is just one type node left, select by default 157 if (typesTreeView.Nodes.Count == 1) { 158 if (typesTreeView.Nodes[0].Nodes.Count == 1) { 159 typesTreeView.SelectedNode = typesTreeView.Nodes[0].Nodes[0]; 160 } 161 } 162 163 if (typesTreeView.Nodes.Count == 0) { 164 SelectedType = null; 165 typesTreeView.Enabled = false; 166 } else { 167 SetTreeNodeVisibility(); 168 typesTreeView.Enabled = true; 169 } 170 UpdateDescription(); 167 171 } 168 172 }
Note: See TracChangeset
for help on using the changeset viewer.