问题描述
现在有没有办法以编程方式最小化UWP应用程序?我的应用程序可以在全屏模式下在平板电脑上运行,并且我不想拖动顶部边缘来调用默认的最小化按钮.
Is there a way to minimize UWP application programmatically now? My app will working on tablet in full screen mode and I don't want to drag top edge to call default minimize button.
推荐答案
随着Windows 10更新1803(内部版本17134)的推出,有一个新的API可用于最小化您的应用程序.
With the Windows 10 update 1803 (build 17134), there is a new API that can be used to minimize your application.
IList<AppDiagnosticInfo> infos = await AppDiagnosticInfo.RequestInfoForAppAsync();
IList<AppResourceGroupInfo> resourceInfos = infos[0].GetResourceGroups();
await resourceInfos[0].StartSuspendAsync();
https://docs.microsoft.com/zh-cn/uwp/api/windows.system.appresourcegroupinfo.startsuspendasync
当前使用此API要求您在内部人员内部版本的清单中声明"appDiagnostics"功能.继续前进,它对于最小化您自己的应用程序不是必需的,而仅仅是对其他应用程序的最小化.
Using this API currently requires you to declare the 'appDiagnostics' capability in your manifest on insider builds. Going forward it should not be required for minimizing your own app, only for minimizing other apps.
这篇关于以编程方式最小化UWP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!