AVaRICEDebugPackage.AVaRICEDebugSettingsControl.btnTest_Click C# (CSharp) Method

btnTest_Click() private method

private btnTest_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void btnTest_Click(object sender, EventArgs e)
        {
            var adapterCommand = (cbAdapter.SelectedItem as PropertyEntry.Enumerated.Suggestion)?.InternalValue;
            UsbDriverHelper.UsbIdentity id = new UsbDriverHelper.UsbIdentity { VID = "03eb" };
            if (adapterCommand != null)
            {
                switch (adapterCommand)
                {
                    case "-2":
                        id.PID = "2103";
                        break;
                    case "-g":
                        id.PID = "2107";
                        break;
                }
            }

            if (id.PID != null)
                if (!UsbDriverHelper.TryCheckDeviceAndInstallDriversInteractively(new UsbDriverHelper.UsbIdentity[] { id }, "com.sysprogs.libusb.mini"))
                    return;

            Process process = new Process();
            process.StartInfo.FileName = _ToolchainBin + @"\avarice.exe";
            process.StartInfo.WorkingDirectory = _ToolchainBin;
            var cfg = Configuration;
            cfg.Remove("com.sysprogs.avr.avarice.erase");
            cfg.Remove("com.sysprogs.avr.avarice.program");
            cfg.Remove("com.sysprogs.avr.avarice.verify");
            cfg.Remove("com.sysprogs.avr.avarice.port");

            process.StartInfo.Arguments = CommandLineTools.BuildCommandLine(_MyMethod.GDBServerArguments, new Dictionary<string, string>(), cfg).Replace(_MyMethod.GDBServerArguments.GNUArgumentPrefix, "") + " -l";

            using (var frm = new CommandTestForm(process))
            {
                frm.ShowDialog();
            }
        }