Does anyone know why control would never get to the delegate although it is invoked? It doesn't get there regardless if I'm step-debugging or not.
public void UpdateClock()
{
//control never gets here
}
delegate void UpdateClockDelegate();
private void MT_TimerTick(object source, ElapsedEventArgs e)
{
if (InvokeRequired)
{
//control gets here, but does not invoke, apparently
Invoke(new UpdateClockDelegate(UpdateClock));
}
}
I based this solution according to the explanation in the following link
Invoke(), behind the scenes it posts a message to the application's message queue which must be processed by the control's message pump. If the UI is currently blocked, the message won't be processed and the method won't be called.Timer.Enabledto true (or callStart()) if you want the timer to raise the event. Did you do that?