开发者

Run function every day at fixed time

开发者 https://www.devze.com 2023-01-06 23:19 出处:网络
I am developing an application in .net.At one point I have to make a function that runs at a fixed time every day. I don\'t want to use Windows开发者_C百科 service. Is there any other way that I can m

I am developing an application in .net. At one point I have to make a function that runs at a fixed time every day. I don't want to use Windows开发者_C百科 service. Is there any other way that I can make this work?


I would just use the Windows Task Scheduler (XP, Vista/7). You can also gain access to the Windows Task Scheduler programmatically.


Calculate the trigger time as

plannedTime - now

then run your method in a separate thread like here: Run a code in given time interval

You will have to re-schedule the thread for the next after it was run.

0

精彩评论

暂无评论...
验证码 换一张
取 消