首页 > 解决方案 > 暂停在 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进程应该停止,否则应该继续。有可能实现吗?

标签: c#xamluwp-xaml

解决方案


推荐阅读