Run function every day at fixed time
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.
精彩评论