extendedExecutionSession :我们可以像桌面应用程序一样运行 UWP 而不挂起吗? [英] extendedExecutionSession : Can we run UWP like Desktop app without Suspending?

查看:28
本文介绍了extendedExecutionSession :我们可以像桌面应用程序一样运行 UWP 而不挂起吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算启动一个 UWP 应用程序,该应用程序可以监控 365 天的传感器数据并将所有数据保存到数据库 (Sqlite).

我仍然担心 UWP 功能.请给我建议我应该使用哪个(UWP/WPF)?我想使用更好的用户界面,而不是,如果可能的话,我想使用 UWP...

UWP-暂停是我的担忧.

通过这个帖子,有人说了一个防止UWP应用程序挂起的方法..

var extendedExecutionSession = new ExtendedExecutionSession();extendedExecutionSession.Reason = ExtendedExecutionReason.Unspecified;var extendedExecutionResult = await extendedExecutionSession.RequestExtensionAsync();if (extendedExecutionResult != ExtendedExecutionResult.Allowed){//扩展执行会话被撤销extendedExecutionSession.Dispose();扩展执行会话 = 空;}

问题

如果我在 UWP 应用程序中编写此代码,我可以使用像桌面 WPF 应用程序这样的 UWP 应用程序吗?我想不间断地运行我的 UWP 应用程序 365 天..即使用户在桌面上最小化"...请建议...

解决方案

是的,您可以使用 ExtendedExecution 做到这一点.需要注意的一件事是,当您使用电池(例如笔记本电脑、平板电脑)运行时,您会在一段时间后被暂停 - 但是您也可以通过进入电池设置页面并将您的应用设置为始终允许"来防止这种情况.

此处记录了详细信息:https://docs.microsoft.com/en-us/windows/uwp/launch-resume/run-minimized-with-extended-execution

I'm planing to start a UWP application that monitor a sensor data for 365 days and save all data to database(Sqlite).

I still worry about UWP capability. Please advice me Which should I use (UWP/WPF) ? I want to use better UI, than, I want to use UWP if possible...

UWP-Suspending is my worry.

With this post, Some people said a way to prevent a UWP application from suspending..

var extendedExecutionSession = new ExtendedExecutionSession();
extendedExecutionSession.Reason = ExtendedExecutionReason.Unspecified;
var extendedExecutionResult = await         extendedExecutionSession.RequestExtensionAsync();
if (extendedExecutionResult != ExtendedExecutionResult.Allowed)
{
//extended execution session revoked
     extendedExecutionSession.Dispose();
     extendedExecutionSession = null;
}

Question

If I wrote this code in UWP app, Can I use a UWP application like Desktop WPF application ? I want to run my UWP application for 365 days without stopping .. even if user do "minimized" on desktop... Please advice it...

解决方案

Yes, you can do that with ExtendedExecution. One thing to note is when you run on battery (e.g. laptop, tablet) you will get suspended after some time - however you can prevent that as well by going into the Battery settings page and set your app as "Always Allowed".

Details are documented here: https://docs.microsoft.com/en-us/windows/uwp/launch-resume/run-minimized-with-extended-execution

这篇关于extendedExecutionSession :我们可以像桌面应用程序一样运行 UWP 而不挂起吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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