// File->AttachToProcess handler; display a dialog box allowing the // user to select a process to attach to. private void _on_file_attach_click(Object sender, System.EventArgs e) { SelectProcessDialog spd = new SelectProcessDialog(); if (spd.ShowDialog(this) == DialogResult.OK) { foreach (Process p in spd.Processes) { AppDomainProfilerForm f = _get_form(); f._create_process(p); f._on_process_attach(m_events.AttachToProcess(p.Id)); } } }
// For testing dialog layout, functionality. // // Compile with: // csc /r:System.Windows.Forms.Dll /r:System.Dll /r:System.Drawing.Dll \ // /r:System.Diagnostics.Dll /r:Microsoft.Win32.Interop.Dll \ // selectprocess.cs Localization.cs wfutils.cs public static void Main() { SelectProcessDialog spd = new SelectProcessDialog(); Console.WriteLine("Select some processes."); if (spd.ShowDialog() == DialogResult.OK) { Console.WriteLine("Selected Processes:"); _processes(spd.Processes); } else { Console.WriteLine("Action Cancelled."); } }