我有一个带有两个按钮的xaml应用程序:一个按钮开始执行我的exe应用程序:
private void RunExe(string exeName)
{
try
{
process = new Process
{
StartInfo =
{
FileName = exeName,
Verb = "runas",
WorkingDirectory = workingDir,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true,
},
EnableRaisingEvents = true
};
process.Start();
}
catch (Exception ex)
{
throw ex;
}
}
另一个按钮是“停止”按钮。单击后,我想停止执行exe文件,直到用户在弹出窗口中确认要停止为止。如果他确认exe进程应该停止,否则应该继续。可以实现吗?