Re: Timer problem
- From: "Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 7 Aug 2008 14:43:00 +0100
That looks like exactly what I need - and it gets rid of all my notification
code, which I was never very happy with anyway! Thanks.
Andy Baker
"Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> wrote in message
news:urLi$CJ%23IHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
The Forms timer is really for shorter period times - for a daily activity
I'd use the notification system (just like for a calendar appointment). A
simple way to use it is with the LargeIntervalTimer class[1] of the
SDF[2].
[1]
http://www.opennetcf.com/library/sdf/html/b2aa8648-0367-b457-db39-13dbb4d21623.htm
http://blog.opennetcf.com/ctacke/2007/03/23/SDF21PreviewGetLIT.aspx
[2] www.smartdeviceframework.com
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"Andy Baker" <abaker@xxxxxxxxxxxxxxxxxx> wrote in message
news:hf6dnZtj3a0MXAfVRVnyhAA@xxxxxxxxxxxxxxxxx
I have a VB.NET 2005 application running on a device that has to connect
to an SQL server overnight to upload data for the next day. The way I have
done this is to have a timer control on my main form that checks
periodically for the time of day. If it is at or after the upload time -
when overnight processes will have run on the server, it connects and
transfers data. I have set an notification event to wake up the device at
the specified time should it be in suspend mode, and all works well - the
first time I try it.
My problem is that while the connection is active, I disable the timer
(Timer.Enabled = false), to prevent it from triggering again while the
transfer is in progress. The Connection class raises a 'completed' event
after the transfer has finished, which is recognised by the main program
and re-enables the timer (Timer.Enabled = true). However, it doesn't
work - the timer tick event never fires again until I restart the
application. I have run it in debug mode and stepped through the code and
the timer is definitely being enabled and I have also put breakpoints
everywhere that affects the timer to see if it being disabled again, but
it isn't. I cannot see what I am doing wrong.
Any suggestions would be appreciated. Is there a better way of doing
what I am trying to other than using a timer? Thanks in advance.
Andy Baker
.
- References:
- Timer problem
- From: Andy Baker
- Re: Timer problem
- From: Chris Tacke, eMVP
- Timer problem
- Prev by Date: Re: Timer problem
- Next by Date: Re: LinkLabel control in CF
- Previous by thread: Re: Timer problem
- Index(es):
Relevant Pages
|