c# - 暂停在 xaml 应用程序中运行 exe 文件的进程
问题描述
我有一个 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进程应该停止,否则应该继续。有可能实现吗?
解决方案
推荐阅读
- java - Spring - 将 pojo 转换为 JSON 时出现问题(未找到转换器错误)
- c# - 如果有一些前台线程在控制台上打印一些东西,在主线程完成他的工作后控制台窗口会关闭吗?
- php - 从单个输入创建 php 变量
- webview - kotlin webview文件上传中的空检查问题
- python - 字符串操作:将扁平字符串转换为树状格式
- c++ - 从 CImageList 设置菜单项位图的难度
- sql - Linq 中的多列检查
- json - 我有一个 Json 数组,只是我想从数组中获取值
- angularjs - Django Rest Framework angularjs 会话身份验证用户
- javascript - reactjs组件上的405(不允许方法)