Пример #1
0
        public static bool SearchWithinNodes(LogLoadProgress logProgress, TreeView searchTreeView, TreeNode startingNode, string text)
        {
            if (logProgress.GetProgressLevel() == 100)
                return false;
            var result = startingNode.Text.Contains(text);
            if (result)
                SelectTreeNode(searchTreeView, startingNode);

            if (!result)
            {
                foreach (TreeNode node in startingNode.Nodes)
                {
                    logProgress.IncreaseProgressLevel(1);
                    if (node.Nodes.Count > 0)
                        result = SearchWithinNodes(logProgress, searchTreeView, node, text);
                    else
                    {
                        result = node.Text.Contains(text);
                        if (result)
                            SelectTreeNode(searchTreeView, node);
                    }

                    if (result)
                        return true;
                }
            }

            if (!result)
            {
                var nextNode = startingNode.NextNode;
                if (nextNode == null && startingNode.Parent != null) nextNode = startingNode.Parent.NextNode;

                return nextNode != null && SearchWithinNodes(logProgress, searchTreeView, nextNode, text);
            }
            return true;
        }
Пример #2
0
 public MainForm()
 {
     InitializeComponent();
     LogProgress = new LogLoadProgress(prbProcess, lblProgress);
 }