how to detect if power cord is plugged-in/put

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

I have problem about detecting power cord plug-in/out to display some
information.

I am developing a application that displays current battery usage and status.
currently, I can get "battery life time" and "battery status" (like high,
low, charge...) correctly. however, if user plug-in/out power cord, my
application cannot respond to this fact, change "low to charging"....

I then use "State and Notification Broker" and delegate a callback function.
This is workable, however, there is a serious dealy after power cord plug.
About 13 seconds will my callback function be called.

Could someone please give me advice. thanks in advance

-terence
 
Did you try SystemState class?

Subscribe to the event SystemState.Changed and you can check status of

bool CradlePresent
or
bool CarKitPresent
 
Back
Top