Ö
Özden Irmak
Hello,
In my application, my main form creates some sub forms which are shown on
top of that main form and all of those forms do have a timer on them. When
the timer elapses, they do raise an event which is catched by the main
form...
My problem in here is that when all that events get raised and all the shown
sub forms have finished running their codes, my main form gets freezed...
For thread safety, I use this code in the main form event subscription
method but the result is still the same :
Control c = sender as Control;
if ( c != null )
{
if ( c.InvokeRequired )
{
c.Invoke(new EventHandler(this.MyEvent));
}
else
{
//Thread is safe, run the code
}
}
Can anybody help me what I'm missing in here?
Thanks,
Özden
In my application, my main form creates some sub forms which are shown on
top of that main form and all of those forms do have a timer on them. When
the timer elapses, they do raise an event which is catched by the main
form...
My problem in here is that when all that events get raised and all the shown
sub forms have finished running their codes, my main form gets freezed...
For thread safety, I use this code in the main form event subscription
method but the result is still the same :
Control c = sender as Control;
if ( c != null )
{
if ( c.InvokeRequired )
{
c.Invoke(new EventHandler(this.MyEvent));
}
else
{
//Thread is safe, run the code
}
}
Can anybody help me what I'm missing in here?
Thanks,
Özden