I'm using c#, winform, I need 3 timers, one that starts every 5 minute at a specific time 09:05, 09:10, 09:15 etc, the second every 1 hour at 10:00, 11:00 etc, and the last one every 4 hours at 13:00, 17:00. All the 3 timer have to start to work at 9 am, it means if I start the program before 9 am, they don't have to do anything, but if I start the program at for example 10, they have to start immediately.
The following is code I use,
#region Timer
//5 minute
int cont=0;
private void timer5Minuti_Tick(object sender, EventArgs e)
{
if (cont_timer == 0) { }
else
{
timer5Minuti.Interval = 300000;
// myfunction();
}
}
//1 hour
private void timerH1_Tick(object sender, EventArgs e)
{
if (cont_timer == 0) { }
else
{
timerH1.Interval = 3600000;
// // myfunction();
}
}
//timer che si aggiorna ogni 4 ore
private void timerH4_Tick(object sender, EventArgs e)
{
if (cont_timer == 0) { }
else
{
timerH4.Interval = 14400000;
// myfunction();
}
}
#endregion