我如何知道用户何时按下 HoloLens 2 手动菜单上的主页按钮?

问题描述 投票:0回答:1

我正在为 HoloLens2 开发 XR 应用程序,我需要知道在按 Windows 按钮后打开手动菜单后何时按下主页按钮。当按下主页按钮或用户想要像这样退出应用程序时,有什么方法可以收到通知吗?

unity-game-engine uwp hololens
1个回答
0
投票

建议使用挂起事件:https://learn.microsoft.com/en-us/windows/uwp/launch-resume/

示例:

Application.Current.Suspending += OnSuspending;


private void OnSuspending(object sender, SuspendingEventArgs e)
{
    var deferral = e.SuspendingOperation.GetDeferral();
    // Save application state and stop any background activity
    deferral.Complete();
}
© www.soinside.com 2019 - 2024. All rights reserved.