Export (0) Print
Expand All

PowerStatus Class

Contains system power information, including battery life status and power line status.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public static class PowerStatus

The example below retrieves power status details.

GraphicsDevice.Clear(Color.CornflowerBlue);
Vector2 pos = Vector2.Zero;
SpriteFont font = Content.Load<SpriteFont>("Font");
string state = "";

state += "\r\nChargeStatus:" + PowerStatus.BatteryChargeStatus;
state += "\r\nBatteryFullLifetime:" + PowerStatus.BatteryFullLifetime.ToString();
state += "\r\nBatteryLifePercent:" + PowerStatus.BatteryLifePercent.ToString();
state += "\r\nBatteryLifeRemaining:" + PowerStatus.BatteryLifeRemaining.ToString();
state += "\r\nPowerLineStatus:" + PowerStatus.PowerLineStatus;

spriteBatch.Begin();
spriteBatch.DrawString(font, state, pos, Color.White);
spriteBatch.End();

Xbox 360, Windows XP SP2, Windows Vista, Zune

Community Additions

ADD
Show:
© 2014 Microsoft