UWP 关闭信息亭模式 [英] UWP turn off kiosk mode
问题描述
我有一个发布到 Windows 应用商店的 UWP 应用程序,并且此应用程序可以启动到信息亭模式(已分配访问权限).效果很好,但我尝试在应用程序上创建一个按钮来关闭信息亭模式并返回到 Windows 登录屏幕.我尝试了文档中给出的代码(
有人能帮我理解这个问题吗?
编辑
这是个例外:
System.Runtime.InteropServices.COMException (0x80004005):调用 COM 组件时返回了错误 HRESULT E_FAIL.在 Windows.ApplicationModel.LockScreen.LockApplicationHost.GetForCurrentView()在 Kiwi.Views.Shell.CloseButton_Tapped(对象发送者,RoutedEventArgs e)
终于找到问题了,我干脆在manifest中添加了这两个Extension:
<uap:Extension Category="windows.aboveLockScreen"/>
现在效果很好!
I have an UWP application published to the Windows Store and this app can be start into kiosk mode (assigned access). It's works great, but I try to create an button on the app to turn off the kiosk mode and to return to the windows loggin screen. I tried the code given in the doc (https://msdn.microsoft.com/library/windows/hardware/mt633799%28v=vs.85%29.aspx) :
LockApplicationHost lockHost = LockApplicationHost.GetForCurrentView();
if (lockHost != null)
{
lockHost.RequestUnlock();
}
But I clicked to the button, the app just close and reopen. But don't exit the kiosk mode... I have an excpetion throw in the store, but it's empty.
Can someone help me to understand the problem ?
EDIT
This is the exception :
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at Windows.ApplicationModel.LockScreen.LockApplicationHost.GetForCurrentView()
at Kiwi.Views.Shell.CloseButton_Tapped(Object sender, RoutedEventArgs e)
Finally I found the problem, I simply add this two Extension in the manifest :
<uap:Extension Category="windows.lockScreenCall" />
<uap:Extension Category="windows.aboveLockScreen" />
And now it's works great!
这篇关于UWP 关闭信息亭模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!