如何在指定时间自动运行任务. [英] How to automatically run a task at a specified time.

查看:64
本文介绍了如何在指定时间自动运行任务.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个应用程序,当有人单击发送"时,该应用程序会向我公司的本地用户发送电子邮件.按钮.

I have my app that sends email to local users of my company when someone click on "Send" button.

该应用程序可以将许多电子邮件存储在单独的文件中,用户只需选择要发送的电子邮件,然后点击发送"即可.按钮.

The app can store many emails in separated files and a user can just choose which one to send and click on "Send" button.

我现在需要对其进行自动化,以便设置计时器以允许用户输入时间&每个电子邮件的日期,以便在指定的时间发送电子邮件.

I need now to automate it in order to set a timer to allow the users to enter the time & date for each Email so that the email be sent at that specified time.

我只需要有关如何做到这一点的想法.我当时想通过设置为500毫秒的计时器来执行此操作,以检查时钟并运行与指定时间匹配的时钟.

I just need ideas on how to do that professionally. As I was thinking of doing that via a Timer set to 500 ms to check the clock and run the one that match the specified time.

,并可能还要检查计时器是否已启动/运行. (如果计算机已关闭)

and maybe check also if the timer did started/run or not. (case where a PC was off)

请我提供提示

提前谢谢!

推荐答案

LMC,

您所描述的实际上是一个调度程序-无关紧要什么.

What you've described is a scheduler really - it doesn't matter what it's for.

环顾四周,您一定会发现多年来写的几本.我建议您将其作为具有一个或多个事件的独立程序集进行.这样,它就不特定于您在此使用的功能.

Have a look around and you're sure to find several that have been written over the years. I'd suggest that you make it as a stand-alone assembly with one or more events. That way it's not specific to what you're using it for here.

每分钟检查两次是费力的-除非您真的需要它那么敏感,否则将其设置为每分钟检查一次,并让您的用户知道它不是第二次"检查.精确.

Checking twice a minute is taxing - unless you really need it to be that sensitive, set it up to check once a minute and let your users know that it's not "to the second" precise.


这篇关于如何在指定时间自动运行任务.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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