在全屏 UWP 应用程序前启动外部进程

Launch external processes in front of full screen UWP app

我有一个 Visual Studio 项目,其中包含两个启动应用程序:一个 UWP 和一个控制台应用程序。在 UWP 中,我以全屏模式启动主页

 ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen; 

在 App.xaml.cs 文件中。然后,我通过创建新进程并将它们的文件名设置为我想要启动的 .exe,在 Program.cs 中启动外部应用程序。但是,当我这样做时,UWP 主页会进入全屏模式,但我看不到外部应用程序。如何让外部应用程序在主页前面启动,以便我在 运行 项目时可以立即看到它们?

How to I make the external apps launch in front of the main page so that I can see them right away when I run the project?

对于这种情况,您可以在外部应用程序启动后以编程方式最小化 UWP,应用程序将自动切换到前面。

IList<AppDiagnosticInfo> infos = await AppDiagnosticInfo.RequestInfoForAppAsync();
IList<AppResourceGroupInfo> resourceInfos = infos[0].GetResourceGroups();
await resourceInfos[0].StartSuspendAsync();

请注意,您需要确保应用程序的迷你版本是 Windows 10 更新 1803(内部版本 17134)。