I'm trying to start a process upon a button press and then stop it when another button is pressed in WPF. When I click the "Start" button, the process starts normally, but when I click the "Stop" button, the process keeps running (I don't get any errors). My code is below:
private Process _process;
private void StartProcess(object sender, RoutedEventArgs e) {
string command = "/C .\\Miners\CryptoMiner1\Miner.exe";
_process = Process.Start("cmd.exe", command);
}
private void StopProcess(object sender, RoutedEventArgs e) {
_process.Kill();
}