C# Power Management

So I was messing around with power management on battery powered devices today and I came across a relatively useful class: cPower class.

Also see C# Suspend and Wakeup

Basically it allows you to check on system state with the following methods:

  • BatteryLifePercent
  • BatteryRemainingSeconds
  • BatteryTotalSeconds
  • HasBattery
  • BatteryLevel
  • BatteryCharging
  • UsingAC
  • DriveAlseep
  • SetPowerReq
  • CanHibernate
  • CanSuspend
  • CanShutdown
  • LockWorkstation
  • LogOff
  • Restart
  • Shutdown
  • Suspend
  • Hibernate

These are the basic functions most apps may use to do power management. The class makes it easy. One thing though.. if you need to make a device come out of standby mode automagically, then you’ll need some other tools… more on that another time…

Comments are closed.