private ProcessNode _create_process(ProcessNode pn) { Debug.Assert(m_procn != null, "You did something stupid."); m_procn = pn; TreeView.Nodes.Add(m_procn); return(m_procn); }
// Remove the process ``e.Process'' from the TreeView. private void _on_process_exit(Object sender, DebuggedProcessEventArgs e) { ProcessNode dp = m_procn; m_procn = null; _history("Process Exit: " + dp.ProcessName); _history("--------"); dp.Remove(); _set_infopanel(m_dmesg); Trace.WriteLine("Current # nodes in tree: " + TreeView.Nodes.Count); }
// Close the current window. private void _close_window(bool force) { if (m_instances > 1) { // there are other windows open, so just close this one. --m_instances; _close_window(); } else if (m_procn != null && !force) { // this is the last window, so clear the TreeView m_procn = null; TreeView.Nodes.Clear(); _reset_interface(); } else { // this is the last window; exit the program. _close_window(); Application.Exit(); } }
// Update the display with information retrieved from ``dn''. public void Display(DisplayableNode dn) { if (!(dn is ProcessNode)) { throw new Exception("internal error: expected ProcessNode"); } ProcessNode pn = (ProcessNode)dn; try { // process needs to be synchronized in order to view modules pn.Process.Stop(5000); foreach (NameValueInfo nv in s_values) { nv.Value.Text = nv.Update(dn); // make text left-aligned in the textbox. if (nv.Value is TextBoxBase) { ((TextBoxBase)nv.Value).SelectionLength = 0; } } _update_appdomains(pn.Process); _update_objects(pn.Process); pn.Process.Continue(false); } catch { if (!pn.Process.IsRunning()) { pn.Process.Continue(false); } } }