I have a timer with 10 seconds interval and on timer_Tick event I do some stuff which usually needs about a second, but sometimes it needs More than 90 seconds. How will it act? Is this event synchronous to wait for the eventhandler to finish executing? I tested but still I need an answer…
private void checkTimer_Tick(object sender, EventArgs e)
{
MessageBox.Show("Test");
for (int i = 0; i < 2000000000; i++)
{
}
MessageBox.Show("Test");
}
when i test it after first tick MessageBox is shown. I don’t click OK and wait for another tick. And another MessageBox is shown on the seconds tick and so on…
in MSDN Documentation I read that it is synchronous… Any Idea?
I solved it by adding timer disabling at the beginning of tick event and enabling at the end of tick event. like this