How System.Timers.Timer behave in WPF application, after Hibernate, and Sleep?

后端 未结 4 788
说谎
说谎 2020-12-29 22:43

I\'m using System.Timers.Timer in my WPF application. I want to understand how Timer does behave, after Computer is hibernated, and sleep. I\'m getting some

4条回答
  •  旧时难觅i
    2020-12-29 23:25

    System.Timers.Timer is a server based timer(elapsed event uses Threadpool. More accurate than other timers). When your computer goes in sleep mode or in hibernate mode, all the state of your program are stored in RAM. Same goes for your application state. Once your system is up your application state will be restored (along with the timer) by the OS. It wont be a good idea to "do something" or try to detect this events. Its possible from a Windows service though. Leave it to the OS to do its job.

提交回复
热议问题