如何在指定时间自动运行任务.

编程入门 行业动态 更新时间:2024-10-24 15:17:41
本文介绍了如何在指定时间自动运行任务.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,

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

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.

更多推荐

如何在指定时间自动运行任务.

本文发布于:2023-10-27 22:52:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534780.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自动运行   时间   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!