To thread or not to thread

  • Thread starter Thread starter Lonifasiko
  • Start date Start date
L

Lonifasiko

Hello group,

My application, among many other things, checks every 5 minutes if user
has got an urgent appointment or meeting. I use a timer that fires
every 5 minutes and just performs a query agains SQL Mobile 2005
database. If an appointment is found, a warning screen is shown.
From this warning screen, user can mark the appointment as "done",
"cancelled", or he can either select to postpone it and to be reminded
in N minutes. When user selects this "repetition" option, I start
another new timer which fires after N minutes selected by the user,
opening a new warning screen and so on.......

Imagine the following situation: user is warned and chooses to postpone
the appointment 10 minutes. After 5 minutes is warned about another
appointment and again decides to put this new appointment off 5
minutes. What does really happen with this two timers I've intialized?
I suppose it's not same timer.

Would be a good idea to use threads for this "warning repetition"
process? Or a separate thread to do all the processing for checking
appointments? Could you please tell me if the approach I'm using (only
timers) is the correct one? What other alternative could I implement?

I do know nothing about threading, I just use a SplashScreen example
that simply runs (Application.Run(SplashScreen())) a new form. Can I
only run forms when threading in CF?

Thanks very much in advance.
 
I'd suggest keeping a list of times when you need to be awakened and set
*one* timer to fire when the earliest time occurs, rather than having
separate timers for every single event. You could use CeRunAppAtTime() to
schedule the setting of an operating system event object and then use a
thread to wait for that event to be set and do the right thing as far as
scheduling the next time it needs to wake up before going back to sleep on
WaitForSingleObject. Check the Notification stuff in OpenNETCF.

Paul T.
 
Back
Top