packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs
/// <summary>
/// Gets a snapshot of the current battery state.
/// </summary>
/// <returns>A <see cref="BatteryState"/> instance that represents 
/// the state of the battery at the time this method was called.</returns>
/// <exception cref="System.InvalidOperationException">The system does not have a battery.</exception>
/// <exception cref="System.PlatformNotSupportedException">Requires XP/Windows Server 2003 or higher.</exception>        
Gets a snapshot of the current battery state.
Gets a snapshot of the current battery state .
public static BatteryState GetCurrentBatteryState()
        {
            CoreHelpers.ThrowIfNotXP();
            return new BatteryState();
        }
public static BatteryState GetCurrentBatteryState ( ) { CoreHelpers . ThrowIfNotXP ( ) ; return new BatteryState ( ) ; }
Gets a snapshot of the current battery state.
Gets a snapshot of the current battery state .
A  instance that represents
the state of the battery at the time this method was called.
A instance that represents the state of the battery at the time this method was called .
The system does not have a battery.
The system does not have a battery .
Requires XP/Windows Server 2003 or higher.
Requires XP / Windows Server 2003 or higher .