Reputation: 2412
I have WPF App, that needs to be update some data , after computer was resumed from Hibernate, or Sleep mode. Details.
If I keep Application open, and sleep computer (or hibernate) after I resume computer, I want to see Application Data updated. Without any click , or focusing..
I tried to use Application.Activated event, but it only works when I click or activate Applicaiton.
What Event Should I use?
Thanks a lot.
Upvotes: 4
Views: 1228
Reputation: 12572
You can have a look at the SystemEvent class. Probably PowerModeChanged will work.
Upvotes: 5
Reputation: 44605
I think you should do this with the Windows APIs directl, overriding WndProc and intercepting messages:
check this one: Can't catch sleep/suspend messages (winXP)
for example on resume from hibernation you would get WM_POWERBROADCAST message with PBT_APMRESUMEAUTOMATIC flag/parameter...
Upvotes: 0