我可以在 Windows Phone 7 上防止屏幕超时吗? [英] Can I prevent screen timeout on Windows Phone 7?

查看:21
本文介绍了我可以在 Windows Phone 7 上防止屏幕超时吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在基于 CE 的 Windows Mobile 中,您可以使用 SetPowerRequirementReleasePowerRequirement API 是这样的:

In the CE based Windows Mobile you could prevent the screen back-light from timing out using the SetPowerRequirement and ReleasePowerRequirement API's like so:

IntPtr handle = SetPowerRequirement("BKL1:", PowerState.FULL, 1, IntPtr.Zero, 0);
// screen won't timeout while you do stuff in here
ReleasePowerREquirement(handle);

WP7 上是否有类似的功能?

Is a similar thing possible on WP7?

推荐答案

是的,这是可能的.您可以使用 PhoneApplicationService.Current.UserIdleDetectionMode 来停止屏幕背光超时并停止屏幕锁定.

Yes, it is possible. You can use PhoneApplicationService.Current.UserIdleDetectionMode to stop the screen backlight timing out and stop the screen from locking.

您还可以使用 PhoneApplicationService.Current.ApplicationIdleDetectionMode 来允许应用程序在锁定屏幕下继续运行.

You can also use PhoneApplicationService.Current.ApplicationIdleDetectionMode to allow the application to keep running under a lock screen.

以下是关于这两个选项的更多详细信息:

Here's some more detail on those two options:

禁用此功能将阻止屏幕超时和锁定.例如,我在下载大文件时禁用 UserIdleDetectionMode,因此应用不会中途终止下载.

Disabling this will stop the screen from timing out and locking. As an example, I disable UserIdleDetectionMode while downloading a large file, so the app doesn't kill the download half-way.

下载完成后,我重新启用 UserIdleDetectionMode,以便屏幕可以像往常一样超时.

When the download is completed, I re-enable UserIdleDetectionMode so the screen can timeout as usual.

注意:这是一次成功.您可以禁用它,但不能重新启用它.

NB: This is a one-time hit. You can disable it, but you cannot re-enable it.

如果您禁用 ApplicationIdleDetectionMode,您的应用将在屏幕锁定时继续运行.如果用户启动不同的应用程序,您的应用程序仍然会死.

If you disable ApplicationIdleDetectionMode, your app will continue to run when the screen locks. Your app will still die if the user starts a different app.

认证要求要求您在第一次禁用 ApplicationIdleDetectionMode 时提示用户.例如.此应用程序将继续在锁定屏幕下运行,并且可能会耗尽您的电池电量.您同意吗?"否则,您的应用将被拒绝.

The certification requirements ask that you prompt the user the first time you disable ApplicationIdleDetectionMode. E.g. "This app will continue to run under a locked screen, and may drain your battery. Are you ok with that?" If you don't your app will be rejected.

这篇关于我可以在 Windows Phone 7 上防止屏幕超时吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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