我正在为Windows 10开发一个有幻灯片放映的应用程序,并且我想防止屏幕自动锁定(关闭)。是否可以?
您可以使用此类来做到这一点Windows.System.Display.DisplayRequest
:
private Windows.System.Display.DisplayRequest _displayRequest;
public void ActivateDisplay()
{
//create the request instance if needed
if (_displayRequest == null)
_displayRequest = new Windows.System.Display.DisplayRequest();
//make request to put in active state
_displayRequest.RequestActive();
}
public void ReleaseDisplay()
{
//must be same instance, so quit if it doesn't exist
if (_displayRequest == null)
return;
//undo the request
_displayRequest.RequestRelease();
}
您可以在此处了解更多信息:https : //blogs.windows.com/buildingapps/2016/05/24/how-to-prevent-screen-locks-in-your-uwp-apps
请确保再次提供您尝试过的内容。是否进行了搜索?..作为开发人员直接问问不是一个好习惯:)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句