而应用程序正在运行,从休眠状态;阻止平板电脑 [英] Prevent tablet from sleeping while app is running

查看:459
本文介绍了而应用程序正在运行,从休眠状态;阻止平板电脑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个Windows 8的平板电脑应用程序,可以经常去接收输入之间的多分钟。

I'm trying to write a Windows 8 tablet app that often can go multiple minutes between receiving input.

现在的问题是,如果我不保持触摸屏幕,节电保护将激活,屏幕会自动变黑,它破坏了应用程序的用户。

The problem is, that if i don't keep touching the screen, the power saver will activate, and the screen will automatically go black, and it disrupts the user of the app.

有没有办法,我的应用程序可以防止电源保护程序激活,或者至少延长花费节电激活的时间。

Is there a way that my app can prevent the power saver from activating, or at least extend the time it takes for the power saver to activate.

推荐答案

您应该使用的DisplayRequest类保持屏幕不关闭。

You should use DisplayRequest class to keep screen from turning off.

应用,显示视频或运行长时间没有用户输入可请求该显示器通过调用DisplayRequest :: RequestActive留在。当显示请求被激活时,该设备的显示屏仍然而应用程序是可见的。当用户移动应用程序出了前景,系统停用应用程序的显示要求,并重新激活它们,当应用程序返回到前台。

Apps that show video or run for extended periods without user input can request that the display remain on by calling DisplayRequest::RequestActive. When a display request is activated, the device's display remains on while the app is visible. When the user moves the app out of the foreground, the system deactivates the app's display requests and reactivates them when the app returns to the foreground.

这篇关于而应用程序正在运行,从休眠状态;阻止平板电脑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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