public void FilterSolutionTree(string text, ESearchIn eSearchIn, TreeView treeView) { if (text.Length <= 2 && eSearchIn != ESearchIn.OpenedDocuments) { if (IsSoultionFiltered) { ResetSolutionFilter(); } return; } string lower = text.ToLower(); IsSoultionFiltered = true; treeView.BeginUpdate(); TreeNodeCollection treeNodeCollection = treeView.Nodes; treeNodeCollection.Clear(); _totalFiind = 0; _currentProgress = 1; _maxProgress = 0; GeneralTreeNodeCollection.ForEach(x => _maxProgress += x.Nodes.Count); SetSolutionTreeStatusText("Searching..."); SetSearchProgress(0); var searchInFileCriteria = new SearchInFileCriteria(text); foreach (TreeNode treeNode in GeneralTreeNodeCollection) { var clonedNode = (TreeNode)treeNode.Clone(); treeNodeCollection.Add(clonedNode); //TreeNode parentfolderNode = clonedNode; } ProcessFindInNodes(null, treeNodeCollection, eSearchIn, lower, text, searchInFileCriteria, null); SetSearchProgress((int)(((float)(_currentProgress) / _maxProgress) * 100)); SetSolutionTreeStatusText("Ready."); if (eSearchIn == ESearchIn.OpenedDocuments) { OpenedDocumentsPanel.SetStatusText($"Opened {_totalFiind} files"); //SetSolutionTreeStatusText($"Opened {_totalFiind} files"); } else { if (eSearchIn == ESearchIn.FileName) { SetSolutionTreeStatusText($"{_totalFiind} file names match '{text}'"); } } { if (eSearchIn == ESearchIn.FileText) { SetSolutionTreeStatusText($"{_totalFiind} files containing '{text}'"); } } treeView.EndUpdate(); }
public void LoadSourceFolder(string selectedPath) { var parentNode = new TreeNode(); var match = Regex.Match(selectedPath, @"[\\]+([^\\]+)[\\]?$"); // get last dir name //var match = Regex.Match(selectedPath, @"([^\\]+$)"); // get last dir name parentNode.Text = match.Groups[1].Value.ToUpper(); parentNode.ToolTipText = selectedPath; parentNode.ImageIndex = 0; parentNode.SelectedImageIndex = 0; parentNode.BackColor = Color.FromArgb(194, 235, 235, 255); GeneralTreeNodeCollection.Add(parentNode); AddFolderItems(parentNode, selectedPath); SetSolutionTree(GeneralTreeNodeCollection); }
private void ClearSolutionTree() { GeneralTreeNodeCollection.Clear(); SetSolutionTree(GeneralTreeNodeCollection); }