コード例 #1
0
        /// <summary>
        /// Handles the click event, but forwards the real work on
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProcMagnetButton_Click(object sender, RoutedEventArgs e)
        {
            List <Process> processes = ProcessHelper.FindProcesses(this.TargetProcess);

            switch (processes.Count)
            {
            case 0:
                MessageBox.Show(String.Format("Could not find \"{0}\"", this.TargetProcess));
                break;

            case 1:
                ProcessHelper.AttachProcess(processes[0]);
                break;

            default:
                // TODO: show a form here and let the user choose which process to attach
                break;
            }
        }