User1234
User1234

Reputation: 2412

What event to use in WPF to update Application after Computer was Resumed after Hibernate or Sleeping?

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

Answers (2)

Adrian Fâciu
Adrian Fâciu

Reputation: 12572

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

Upvotes: 5

Davide Piras
Davide Piras

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

Related Questions