private void PopulateFavoriteList(string pattern) { treeDest.BeginUpdate(); treeDest.Nodes.Clear(); var sc = new SortedDictionary <string, List <string> >(); foreach (var cellNumber in Map.Cells.Keys) { var cell = Map.Cells[cellNumber]; if (cell.Tooltip.IndexOf(pattern, StringComparison.CurrentCultureIgnoreCase) >= 0) { if (!sc.ContainsKey(cell.Tooltip)) { sc.Add(cell.Tooltip, new List <string> { cell.CellNumber }); } else { sc[cell.Tooltip].Add(cell.CellNumber); } } } if (sc.Count > 0) { var treeNode = MakeGroupNode("Подходящие названия"); foreach (var gc in sc) { if (gc.Value.Count == 1) { AddLocation(treeNode, gc.Value[0]); } else { var groupCell = new GroupCell(gc.Key); foreach (var cellNumber in gc.Value) { groupCell.AddCell(cellNumber); } AddGroupLocation(treeNode, groupCell); } } } treeDest.EndUpdate(); if (treeDest.Nodes.Count > 0) { treeDest.Nodes[0].Expand(); } }
private void PopulateSkinRes(TreeNode parent, string title, string pattern) { var list = new List <string>(); foreach (var cellNumber in Map.Cells.Keys) { var cell = Map.Cells[cellNumber]; if (cell.IsBot(pattern)) { list.Add(cell.CellNumber); } } var groupCell = new GroupCell(title); foreach (var cellNumber in list) { groupCell.AddCell(cellNumber); } AddGroupLocation(parent, groupCell); //var rootNode = MakeNode(parent, title, cellNumber); }