[UWP] Windows如何为后台任务处理错过的计时器事件 [英] [UWP]How does Windows Handle Missed Timer Events for Background Tasks

查看:124
本文介绍了[UWP] Windows如何为后台任务处理错过的计时器事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我计划每天在12:00开始一次由计时器触发的后台任务。所以我创建了一个TimeTrigger,TimeSpan的分钟数直到下一个12:00

所以后台任务应该在12:00左右开始,所以它不需要准时开始但是只有大约24小时左右。

I plan to make a background task triggered by timer once a day at 12:00. So I create a TimeTrigger with a TimeSpan of the number of minutes until the next 12:00
So the background task should start around 12:00 o'clock, hoewever it needs not to start exactly at time but only around and every 24 hours.

我的问题是:

如果错过定时器事件,Windows如何处理因为例如此时机器没有运行。

a)一旦Windows启动并再次运行,后台任务是否启动,或者是
b)后台任务是否从未再次启动如果我使用OneShot = false,则错过计时器事件或仅在24小时后再次开始计时事件。

My question is:
How does windows handle if the timer event is missed because e.g. the machine is not running at this time.
a) Is the background task started as soon as windows is started and running up again or
b) Is the background task never started again as the timer event is missed or only started again after once more of a time of 24 hours if I use OneShot=false.

在b)的情况下b
如何分别处理错过的计时器事件或启动后台任务?

In a case of b)
How can I handle missed timer events or start the background task after booting respectively ?

亲切的问候,

Tom

Kind regards,
Tom

推荐答案

>>如果错过计时器事件,Windows如何处理因为例如机器此时没有运行

>>How does windows handle if the timer event is missed because e.g. the machine is not running at this time

答案是A.后台任务将在Windows启动并再次运行时启动。 我有一个带定时器触发后台任务的应用程序。如果应在时间后台任务触发时关闭机器。启动设备时,后台
任务将再次触发。 并且它不会影响下一个后台任务的启动。

The answer is A. The background task will started as soon as windows is started and running up again.  I had an app with timer triggered background task in it. If the machine is shut down when the time background task should trigger. The background task will trigger again when you start up your device.  And it won't affect the startup of the next background task.

祝你好运,

Roy


这篇关于[UWP] Windows如何为后台任务处理错过的计时器事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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