A
Anthony Boudouvas
Hi to all,
i have a form with 2 System.Windows.Forms.Timer objects.
One fire every 5 seconds and the other every 10 seconds,
the both take actions in two hashtables declared in same form.
When timers fire, main form is somewhat blocking until timers finish
their job, (socket operations). (Imagine to move the form by it's caption
bar and it somewhat freeze when timers fire...)
How i can design this so this blocking do not happen ?
Imagine that i am building an application like Sql Server's
Enterprise Manager, it continuously talks(in the background)
via sockets so it can display it's registered servers' status but it allows
you
to work smoothly with it in the foreground.
I tried to spawn a thread to accomplish that
(ThreadPool.QueueUserWorkItem(new WaitCallback(CheckPendingServants))
but the problem remains.
I also thought that because these 2 timer routines take actions on the
forms' hashtables,
the code running in these 2 threads will have problems to communicate with
form's main thread
and needs some delegate mechanism to do so.
I also build this too but problem remains...
My last thought is to create a second form with these 2 timers and hide it,
this form will do all work and just take actions on the -now- public
hashtables
on the main form.
Does any other idea comes to mind ?
Thanks a lot
anthonyb
i have a form with 2 System.Windows.Forms.Timer objects.
One fire every 5 seconds and the other every 10 seconds,
the both take actions in two hashtables declared in same form.
When timers fire, main form is somewhat blocking until timers finish
their job, (socket operations). (Imagine to move the form by it's caption
bar and it somewhat freeze when timers fire...)
How i can design this so this blocking do not happen ?
Imagine that i am building an application like Sql Server's
Enterprise Manager, it continuously talks(in the background)
via sockets so it can display it's registered servers' status but it allows
you
to work smoothly with it in the foreground.
I tried to spawn a thread to accomplish that
(ThreadPool.QueueUserWorkItem(new WaitCallback(CheckPendingServants))

but the problem remains.
I also thought that because these 2 timer routines take actions on the
forms' hashtables,
the code running in these 2 threads will have problems to communicate with
form's main thread
and needs some delegate mechanism to do so.
I also build this too but problem remains...
My last thought is to create a second form with these 2 timers and hide it,
this form will do all work and just take actions on the -now- public
hashtables
on the main form.
Does any other idea comes to mind ?
Thanks a lot
anthonyb