No manual updating of fields - saves code and threading headaches and you could go for a "real" (=threaded) timer approach. Shut IT - Shutdown Timer 2.0.0. If you use WPF you should really use binding and not code-behind. Shut Down PC - Shut Down Windows is a simple countdown tool that allows you to schedule an automatic shutdown time for your PC. Bonus: This way you can make your timer intervall shorter than one second and get a more "smooth" time display.ģ. Why?: Gui-Timer-Events will be thrown away if not processed between ticks, so in your app it can happen that the timer doesn't "see" a tick for some intervalls and your "time calculation" goes wrong. Better: Store the "start time" and get the current time inside timer tick, than calculate difference between start time and current system time and apply your math.
Step 2 Type 'shutdown -s -tThe UI is clean and purpose-driven so that any skill level user can take advantage of this.
Adios - Shutdown Timer includes three-time modes: idle/time/clock and any scheduled timers are started as separate processes.
If you calculate the "elapsed time" in your timer tick - so you can update the GUI - never use the tick-Intervall for calculations (your timeleft variable (should be named secondsleft.). From the Start menu, open the Run dialog box or you can Press the 'Window + R' key to open the RUN window. To create a shutdown timer manually, open Command Prompt and type the command shutdown -s -t XXXX. Adios - Shutdown Timer provides you with a straightforward freeware app that allows you to schedule PC shutdown, restart, lock, log off and hibernate all from a clean interface. Even worse in a WPF app a Systems Windows forms timer.Ģ. So I feel you could need some tips (maybe for your next app?)ġ. But you use a fundamentally wrong approach. Though Windows has no visible option to create a Windows shutdown timer, you can auto shutdown Windows with a single command. For your purpose and desired accuracy it seems ok. The only thing I quickly recognized was the "missuse" of a timer.