One of the new cool new classes in .net 2.0 is the PowerStatus class (http://msdn2.microsoft.com/en-us/library/system.windows.forms.systeminformation.powerstatus(VS.80).aspx
). You can use this class to get information about the battery life of
your mobile computer. In my case this is for a Tablet PC application
that I am working on for work.
For our project we wanted to get
the battery life information for a Tablet PC and display to the user
both the amount battery life lift as well as display a visual indicator
when the battery goes below a wired percentage. For this post, I am
just going to give a simple overview of some of the different things
you can do with this class.
1) Get the Power Status
Gets the current system power status.
2) Get the Charge Status
Gets the current battery charge status.
3) Get the Battery Life Percent
Gets the approximate percentage of the full battery left.
4) Get the Battery Life Remaining
Gets the approximate number of seconds of the battery time remaining.
5) Get the Full Life Amount for the Battery
Gets the reported full charge lifetime of the battery power source in seconds.
There you have it, a clean and simple way to use the PowerStatus class in .net. The namespace that this class belongs to ystem.Windows.Forms.SystemInformation has some pretty cool little features in it. You should check it out at http://msdn2.microsoft.com/en-us/library/system.windows.forms.systeminformation_properties(VS.80).aspx
Hope everyone has a great Thanksgiving, I'm off till next week....
11-20-2006 8:46 PM