timer...

  • Thread starter Thread starter Lakefront
  • Start date Start date
L

Lakefront

Hello:
I am having some issues with a form timer.
here's what i'm doing:
In the main app i create a custom userControl object and call it's Init
method. Now, within the Init method, i do some work and Start a form
timer. The timer fires and the associated event handler executes.
In the event handler, i Stop the timer, do an async call-out with a
completion delegate and continue. The completion delegate will Start
the timer.

problem:
the completion delegate executes and the Start timer call is made, but
the associated event handler is never executed.
---

I tried using Invoke because the completion delegate will execute on
another thread, i.e., a different thread to the one that owns the
timer... but no luck. not sure if i'm using the correct Invoke syntax.

thanks in advance...
 
Lakefront said:
[...]
problem:
the completion delegate executes and the Start timer call is made, but the
associated event handler is never executed.

If you are doing "an async call-out with a completion delegate", does that
mean that the delegate runs on a different thread than that used for the
control/form?

If so, I don't find it surprising that you don't get the timer restarted.
If the completion delegate isn't run on the control/form timer, then for it
to restart the timer it would probably need to use Invoke to make sure the
timer is restarted on the correct thread.

If that's not what you mean, then I don't have any answers. Sorry. :)

Pete
 
thanks for the response pete.
yes, that's what i meant. but, i did use Invoke, but no luck.
----


Peter said:
Lakefront said:
[...]
problem:
the completion delegate executes and the Start timer call is made, but the
associated event handler is never executed.

If you are doing "an async call-out with a completion delegate", does that
mean that the delegate runs on a different thread than that used for the
control/form?

If so, I don't find it surprising that you don't get the timer restarted.
If the completion delegate isn't run on the control/form timer, then for it
to restart the timer it would probably need to use Invoke to make sure the
timer is restarted on the correct thread.

If that's not what you mean, then I don't have any answers. Sorry. :)

Pete
 
Back
Top