473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

timer...

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...
Dec 14 '06 #1
3 1520
"Lakefront" <sb****@acm.orgwrote in message
news:45***********************@roadrunner.com...
[...]
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
Dec 14 '06 #2
Do you have a small code sample that demonstrates the problem you are having?

Mark.
--
http://www.markdawson.org
"Lakefront" wrote:
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...
Dec 14 '06 #3
thanks for the response pete.
yes, that's what i meant. but, i did use Invoke, but no luck.
----
Peter Duniho wrote:
"Lakefront" <sb****@acm.orgwrote in message
news:45***********************@roadrunner.com...
>[...]
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

Dec 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
2
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
12
by: Gina_Marano | last post by:
I have created an array of timers (1-n). At first I just created windows form timers but I read that system timers are better for background work. The timers will just be monitoring different...
8
by: KnighT | last post by:
I have a .net service that runs a System.Threading.Timer. The delegate points to the function that the service should execute when the timer elapses. Problem: The timer is not ticking. I have...
8
by: =?Utf-8?B?RGF2ZSBCb29rZXI=?= | last post by:
I have a Timer that I set to go off once a day, but it frequently fails! In order to debug I would like to be able to check, at any moment, whether the Timer is enabled and when it will next...
11
by: Hotrod2000 | last post by:
I'm quite new to programming but I'm having problems getting a timer to work in visual studio.net I've created a timer on a form, enabled it and then typed the following code (from the mdsn...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.