Inactivity Timer that isn't defeated by System Suspend

  • Thread starter Thread starter Jared Miniman [MVP]
  • Start date Start date
J

Jared Miniman [MVP]

I have a relatively simple problem. I have a C# form that for whatever
reason wants a given event to occur every 15 minutes of inactivity.
Inactivity of 15 minutes is defined as 15 minutes passing without an
OnPaint call having taken place on that form. The OnPaint activity monitor
works as prescribed, so long as the device remains on. However, when the
device goes into suspend mode (either via auto power off or user hits the
power button), the timer no longer "clicks". So an hour might have gone by
since the user turned off the device, but since the timer halted, we
continue where it last left off.

How do I get around this issue of the timer control going to sleep during a
suspend? Seems like a basic threading issue--should I create this control
on a separate thread? Perhaps someone can chime in?

--
_________________________________
Jared Miniman, MS-MVP Mobile Devices
Mobile Computer Consultant

ActiveSync problems?
http://www.microsoft.com/mobile/pocketpc/support/help/activesync.asp
Connection Mngr Q's?
http://www.microsoft.com/mobile/pocketpc/tutorials/connectionmanager
 
The point of supended mode is that the code *does not execute* Why don't you
check the actual time passed since the last timer event in the OnTimer? Also
it might help making the timer interval much smaller than 15 min - say 10
sec or so - this way you wil be able to detect time spent in suspended mode
as soon as in 10 sec after wakeup
 
Thanks to both of you. I'm aware of the "catching power down notification
event" trick, and I assumed that the timer halting is expected suspend
behavior. I will merely keep track of the last time before suspension and
see, upon wakeup, if X minutes have elapsed.

--
_________________________________
Jared Miniman, MS-MVP Mobile Devices
Mobile Computer Consultant

ActiveSync problems?
http://www.microsoft.com/mobile/pocketpc/support/help/activesync.asp
Connection Mngr Q's?
http://www.microsoft.com/mobile/pocketpc/tutorials/connectionmanager
 
Back
Top