Solved

Fire up function on certain time.

Posted on 2004-10-02
4
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MailAddress in vb 4 36
How to verify that an email address ends with a particular set of characters in C#? 2 39
linq, c# 8 33
c#, datatable, aspx 4 20
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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