我正在为 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
请再次确保提供您尝试过的内容..您是否搜索过它?..作为开发人员直接询问不是一个好的做法:)。
