在xaml应用程序中暂停运行exe文件的进程

时间:2018-11-09 08:52:44

标签: c# xaml uwp-xaml

我有一个带有两个按钮的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进程应该停止,否则应该继续。可以实现吗?

0 个答案:

没有答案