- Timestamp:
- 07/23/17 00:52:14 (7 years ago)
- Location:
- branches/Async
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Async
- Property svn:mergeinfo changed
-
branches/Async/HeuristicLab.Optimizer
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Optimizer (added) merged: 13397,13406,13433-13434,13567,13586,13671,13681,13813
- Property svn:mergeinfo changed
-
branches/Async/HeuristicLab.Optimizer/3.3/NewItemDialog.cs
r12649 r15280 93 93 } 94 94 95 #region Create Tree 95 96 private TreeNode CreateCategoryTree(IEnumerable<IGrouping<string, Type>> categories) { 96 97 imageList.Images.Add(VSImageLibrary.Class); // default icon … … 176 177 return itemNode; 177 178 } 179 #endregion 178 180 179 181 private void NewItemDialog_Shown(object sender, EventArgs e) { 180 searchTextBox.Text = string.Empty; 181 searchTextBox.Focus(); 182 SelectedType = null; 183 typesTreeView.SelectedNode = null; 184 UpdateDescription(); 185 186 foreach (TreeNode node in typesTreeView.Nodes) 187 node.Expand(); 188 typesTreeView.Nodes[0].EnsureVisible(); 182 Reset(); 189 183 } 190 184 … … 221 215 // select first item 222 216 typesTreeView.BeginUpdate(); 217 typesTreeView.ExpandAll(); 223 218 var firstNode = FirstVisibleNode; 224 219 while (firstNode != null && !(firstNode.Tag is Type)) … … 243 238 private bool FilterNode(TreeNode node, string[] searchTokens) { 244 239 if (node.Tag is string) { // Category node 245 int i = 0; 246 while (i < node.Nodes.Count) { 247 bool remove = FilterNode(node.Nodes[i], searchTokens); 248 if (remove) 249 node.Nodes.RemoveAt(i); 250 else i++; 240 var text = node.Text; 241 if (searchTokens.Any(token => !text.ToLower().Contains(token))) { 242 int i = 0; 243 while (i < node.Nodes.Count) { 244 bool remove = FilterNode(node.Nodes[i], searchTokens); 245 if (remove) 246 node.Nodes.RemoveAt(i); 247 else i++; 248 } 251 249 } 252 250 return node.Nodes.Count == 0; 253 } if (node.Tag is Type) { // Type node 251 } 252 if (node.Tag is Type) { // Type node 254 253 var text = node.Text; 255 254 if (searchTokens.Any(searchToken => !text.ToLower().Contains(searchToken))) { … … 308 307 protected virtual void searchTextBox_TextChanged(object sender, EventArgs e) { 309 308 Filter(searchTextBox.Text); 309 if (string.IsNullOrWhiteSpace(searchTextBox.Text)) 310 Reset(); 310 311 } 311 312 … … 333 334 private void SetTreeNodeVisibility() { 334 335 TreeNode selectedNode = typesTreeView.SelectedNode; 335 if (string.IsNullOr Empty(currentSearchString) && (typesTreeView.Nodes.Count > 1)) {336 if (string.IsNullOrWhiteSpace(currentSearchString) && (typesTreeView.Nodes.Count > 1)) { 336 337 typesTreeView.CollapseAll(); 337 338 if (selectedNode != null) typesTreeView.SelectedNode = selectedNode; … … 339 340 typesTreeView.ExpandAll(); 340 341 } 341 if (selectedNode != null) selectedNode.EnsureVisible(); 342 if (selectedNode != null) { 343 typesTreeView.Nodes[0].EnsureVisible(); // scroll top first 344 selectedNode.EnsureVisible(); 345 } 346 } 347 private void Reset() { 348 searchTextBox.Text = string.Empty; 349 searchTextBox.Focus(); 350 SelectedType = null; 351 typesTreeView.SelectedNode = null; 352 UpdateDescription(); 353 354 typesTreeView.BeginUpdate(); 355 typesTreeView.CollapseAll(); 356 foreach (TreeNode node in typesTreeView.Nodes) 357 node.Expand(); 358 typesTreeView.Nodes[0].EnsureVisible(); 359 typesTreeView.EndUpdate(); 342 360 } 343 361 #endregion
Note: See TracChangeset
for help on using the changeset viewer.