Solved

Fire up function on certain time.

Posted on 2004-10-02
4
212 Views
Last Modified: 2011-09-20
I have 3 times of a day in configuration file, and I want to start the same function on that time everyday by my windows service.
How can I accomplish that?
I read the times in string format, for now it is 24h clock format. Is that the best way to have it in config file?

Config file:
      <time1>7:00</time1>
      <time2>13:00</time2>
      <time3>19:00</time3>
0
Comment
Question by:glowas
  • 2
4 Comments
 
LVL 22

Assisted Solution

by:cookre
cookre earned 100 total points
ID: 12210127
The easiest way is to use a one second timer to see if a scheduled time has arrived or been slightly passed.

To avoid too much unneeded checking, upon service load or just after each scheduled event, set the timer interval to the time to wait before the next scheduled event, less a minute or so.  When that amount of time has elapsed, you can put the timer into one second intervals.
0
 
LVL 22

Expert Comment

by:cookre
ID: 12210129
... and don't forget about midnight.
0
 
LVL 5

Assisted Solution

by:Kelmen
Kelmen earned 100 total points
ID: 12215619
You may try just using the Windows Scheduler, which also allow mutilple scheduling. Use it to trigger your console app.

Though there's some limitations in it. The one bugged me most is the status checking mechanism of the Scheduler. You have to work it out instead of relying the Scheduler for proper logging.
0
 
LVL 10

Accepted Solution

by:
123654789987 earned 300 total points
ID: 12215929
Here is a good example of using a windows service with a scheduler

http://www.codeproject.com/csharp/scheduler.asp
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now