Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
i have a timer that shows a form every time a round hour passes ( 3 PM, 4 PM, 5 PM), after PC hibernates, it shows not on round hours anymore...

the first time the timer takes how much time left to the next hour, and takes 60 minutes each time afterwards...
Posted
Updated 16-Oct-14 7:39am
v3
Comments
BillWoodruff 16-Oct-14 15:01pm    
Are you handling the SystemEvents.PowerModeChanged in Microsoft.Win32 to detect when your system hibernates and returns from hibernation ?

If you start monitoring at 6PM, and the user puts the computer into sleep mode at 10:35 PM, and resumes from sleep mode at 3:39AM,when do you want the user to get the first notification after 3:39AM ?
Sergey Alexandrovich Kryukov 16-Oct-14 17:12pm    
Much better idea than Solution 1. Will you post it as an answer?
—SA
john1990_1 16-Oct-14 19:23pm    
i want a notification every 00 hour, example 5:00 PM then 6:00 PM then 7:00 PM

suppose the program started at 5:34, then the timer will be set to 26 mins, then 60 mins each next time

if the user's PC is hibernating on a 00 hour, it skips notifying on that 00 hour
Sergey Alexandrovich Kryukov 16-Oct-14 17:13pm    
Interesting problem, a 5.
—SA

1 solution

Lower your timer tick() to 5-15 seconds (or even 60 seconds) and check if the DateTime at the top of the hour.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900