-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBatteryPerformance.cs
36 lines (32 loc) · 1.24 KB
/
BatteryPerformance.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
using Microsoft.WindowsAPICodePack.Taskbar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TaskbarPerformance
{
public class BatteryPerformance : AbstractPerformanceWindow
{
private readonly PowerStatus powerStatus = SystemInformation.PowerStatus;
public BatteryPerformance(Timer timer) :base(timer) {}
public override string FormatText(float value) => $"Battery: {Math.Floor(value)} %";
public override TaskbarProgressBarState MapState(float value) => powerStatus.BatteryChargeStatus switch
{
BatteryChargeStatus.Charging => TaskbarProgressBarState.Indeterminate,
BatteryChargeStatus.Critical => TaskbarProgressBarState.Error,
BatteryChargeStatus.Low => TaskbarProgressBarState.Paused,
BatteryChargeStatus.NoSystemBattery => TaskbarProgressBarState.NoProgress,
_ => TaskbarProgressBarState.Normal
};
public override float ProvideMaxValue()
{
throw new NotImplementedException();
}
public override float ProvideValue()
{
throw new NotImplementedException();
}
}
}