Prevent tablet from sleeping while app is running

≡放荡痞女 提交于 2019-12-07 06:12:17

问题


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.


回答1:


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

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.




回答2:


Go to your screen saver in personalization settings. Select none.



来源:https://stackoverflow.com/questions/13202146/prevent-tablet-from-sleeping-while-app-is-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!