Re: Timer problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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






.



Relevant Pages

  • Re: File system change notifications
    ... notification for the same file) which might appear the same in the ... the notification is just a duplicate of a previous one so I must ... Also note although Brian uses a API based timer with a hidden window, that really does nothing substantial over the VB6 timer component. ...
    (microsoft.public.vb.general.discussion)
  • Re: [PATCH] virtio_net: free transmit skbs in a timer
    ... enables interrupts and waits for notification that more ... to let TX packets "hang out" in the TX ring unreclaimed ... Add a timer to ensure that any time we queue new TX ... networking and depend on timely completion notification. ...
    (Linux-Kernel)
  • Re: Timer problem
    ... and keep the timer active. ... Andy Baker wrote: ... the specified time should it be in suspend mode, and all works well - the ... The Connection class raises a 'completed' ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: [take12 0/3] kevent: Generic event handling mechanism.
    ... Since this is the sixthevent notification system that's getting ... userspace API is right this time? ... Just looking at the proposed kevent API, it appears that the timer event ...
    (Linux-Kernel)
  • Process Monitor Hooks
    ... Notification should receive the information about the process as well. ... Whenever a timer is fired - i get list of all the ... 2- Somehoe Hook into this process creation/destruction ... I think the timer option will be less expensive in the form of ...
    (microsoft.public.win32.programmer.kernel)