public void filter_cleaners(TreeView treeView1, List <string> searchstring, TextBox textBox1, PictureBox pictureBox1) { //blocks repainting tree till all objects loaded treeView1.BeginUpdate(); treeView1.Nodes.Clear(); if (textBox1.Text != string.Empty) { pictureBox1.Image = global::pcsm.Properties.Resources.x; for (int x = 0; x < DiskCleaner._fieldsTreeCache.Nodes.Count; x++) { Match m1 = Regex.Match(DiskCleaner._fieldsTreeCache.Nodes[x].Text, textBox1.Text, RegexOptions.IgnoreCase); if (m1.Success) { for (int y = 0; y < DiskCleaner._fieldsTreeCache.Nodes[x].Nodes.Count; y++) { searchstring.Add(DiskCleaner._fieldsTreeCache.Nodes[x].Nodes[y].Tag.ToString()); } } else { for (int y = 0; y < DiskCleaner._fieldsTreeCache.Nodes[x].Nodes.Count; y++) { Match m = Regex.Match(DiskCleaner._fieldsTreeCache.Nodes[x].Nodes[y].Tag.ToString(), textBox1.Text, RegexOptions.IgnoreCase); Match m2 = Regex.Match(DiskCleaner._fieldsTreeCache.Nodes[x].Nodes[y].Text, textBox1.Text, RegexOptions.IgnoreCase); if (m.Success) { searchstring.Add(DiskCleaner._fieldsTreeCache.Nodes[x].Nodes[y].Tag.ToString()); } else if (m2.Success) { searchstring.Add(DiskCleaner._fieldsTreeCache.Nodes[x].Nodes[y].Tag.ToString()); } else { } } } } DiskCleaner.search_cleaners(treeView1, "blb\\Bleachbit.ini", searchstring); searchstring.Clear(); treeView1.ExpandAll(); } else { pictureBox1.Image = global::pcsm.Properties.Resources.q; foreach (TreeNode _node in DiskCleaner._fieldsTreeCache.Nodes) { treeView1.Nodes.Add((TreeNode)_node.Clone()); } DiskCleaner.selectionload(treeView1, "blb\\Bleachbit.ini"); } //enables redrawing tree after all objects have been added treeView1.EndUpdate(); }
private void Form1_Load(object sender, EventArgs e) { DiskCleaner.selectionload(treeView1, "blb\\Bleachbit.ini"); DiskCleaner._fieldsTreeCache.Nodes.Clear(); foreach (TreeNode node in treeView1.Nodes) { DiskCleaner._fieldsTreeCache.Nodes.Add((TreeNode)node.Clone()); } _fieldsTreeCache1.Nodes.Clear(); foreach (TreeNode node in treeView1.Nodes) { _fieldsTreeCache1.Nodes.Add((TreeNode)node.Clone()); } }
private void Form1_Load(object sender, EventArgs e) { DiskCleaner.selectionload(treeView1, "blb\\Bleachbit.ini"); }