Downloads:
Features:
- Show battery status and check if the charger connected or not
C# Source Code:
- Main.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
using System; using System.Drawing; using System.Windows.Forms; namespace Battery_Status { public partial class Main : Form { PowerStatus power = SystemInformation.PowerStatus; // Battery public Main() { InitializeComponent(); } private void Timer_Tick(object sender, EventArgs e) { if (Convert.ToBoolean(power.BatteryLifePercent * 100 >= 100)) { progressBar1.Value = 100; } else if (Convert.ToBoolean(power.BatteryLifePercent * 100 < 100)) { progressBar1.Value = (int)(power.BatteryLifePercent * 100); } if (power.PowerLineStatus == PowerLineStatus.Online) { label2.Text = "Connected"; label2.ForeColor = Color.Green; this.label3.Text = string.Format("{0} %", (power.BatteryLifePercent * 100)); } else if (power.PowerLineStatus == PowerLineStatus.Offline) { label2.Text = "Not Connected"; label2.ForeColor = Color.Red; this.label3.Text = string.Format("{0} %", (power.BatteryLifePercent * 100)); } } } } |
Screenshots:
Similar Apps:
Unknown
Contact: