4

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.

User1234
  • 2,362
  • 4
  • 27
  • 57

2 Answers2

5

You can have a look at the SystemEvent class. Probably PowerModeChanged will work.

Adrian Fâciu
  • 12,414
  • 3
  • 53
  • 68
0

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...

Community
  • 1
  • 1
Davide Piras
  • 43,984
  • 10
  • 98
  • 147