如何在 Windows Phone 8 中以编程方式锁定屏幕? [英] how to lock the screen programmatically in windows phone 8?
问题描述
我们可以使用下面的代码防止屏幕锁定
We can prevent the screen to lock using the below code
PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled
和
PhoneApplicationService.Current.UserIdleDetectionMode= IdleDetectionMode.Disabled
但是如何从我的应用程序锁定屏幕.喜欢下面的应用程序
but how to lock the screen from my app. Like the below app
提前致谢
推荐答案
@yasen 写的是正确的.
What @yasen wrote is correct.
[DllImport("ShellChromeAPI.dll")]
private extern static void Shell_TurnScreenOn(bool value);
我尝试过以下情况:
Runtime 8.1 C#(通过商店认证)
运行时 8.1 C++ 与运行时组件 8.1 C#(尚未尝试在商店中发布)
Silverlight/DirectX 8.0 C++(通过商店认证)
I've tried the following cases:
Runtime 8.1 C# (Passed store certification)
Runtime 8.1 C++ with Runtime Component 8.1 C# (Haven't tried to publish this in store)
Silverlight/DirectX 8.0 C++ (Passed store certification)
这是我的应用的链接,该应用使用上述最后一个解决方案.
http://www.windowsphone.com/s?appid=38bf5918-025e-4f23-b515-2cac451a84ab
Here's the link to my app that's using the last solution mentioned above.
http://www.windowsphone.com/s?appid=38bf5918-025e-4f23-b515-2cac451a84ab
我听说过商店使用支持 8.0 和 8.1 的 Silverlight 的案例.
And I've heard about cases in store using Silverlight that supports 8.0 and 8.1.
这篇关于如何在 Windows Phone 8 中以编程方式锁定屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!