如何在 Windows Phone 8 中以编程方式锁定屏幕? [英] how to lock the screen programmatically in windows phone 8?

查看:29
本文介绍了如何在 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

http://www.windowsphone.com/en-us/store/app/one-touch-lockscreen/a3b1220b-1f9a-4bf0-93bc-21ed02792279

提前致谢

推荐答案

@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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆