// Adds "some" of the nodes to the Tree // May need to be run more then once to process them all. This is because // children can have lower pid's then the parents. (Don't ask me how or why) // private PidList AddBranches(PidList Updates) { PidList Retry = new PidList(); // In some weird instances children // can have a lower pid then the parent // So we have to do retry's Updates.Sort(PidFields.Parent); foreach (Pid p in Updates) { TreeNode tmp = new TreeNode(p.Name); // Create the node tmp.Name = p.Id.ToString(); // Set it's key // Look for its parent process in the tree // TreeNode[] t = PidTree.Nodes.Find(p.Parent.ToString(), true); if (t.Length == 0) // Not found { Retry.Add(new Pid(p.Name, p.Id, p.Parent)); } else // Found { t[0].Nodes.Add(tmp); t[0].Expand(); // Add as a running process // Running.Add(new Pid(p.Name, p.Id, p.Parent)); } } return(Retry); }
private void CreatePidList(TreeNode n) { ReturnPids.Add(Running.Find(n.Name, PidFields.Id)); foreach (TreeNode Search in n.Nodes) { CreatePidList(Search); } }