-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPowerMode.cs
55 lines (46 loc) · 1.48 KB
/
PowerMode.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
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Attribute should be given to FluentFlyouts3:
* https://github.com/FireCubeStudios/FluentFlyouts3
*/
namespace BatteryTracker.Models;
public enum PowerModeEnum
{
BetterBattery = 0,
Balanced = 1,
BestPerformance = 2
}
public static class PowerModeIds
{
public static readonly Guid BetterBattery = new("961cc777-2547-4f9d-8174-7d86181b8a7a");
public static readonly Guid Balanced = new("00000000-0000-0000-0000-000000000000");
public static readonly Guid BestPerformance = new("ded574b5-45a0-4f42-8737-46345c09c238");
}
public sealed record PowerMode(PowerModeEnum Mode, Guid Guid)
{
public static readonly PowerMode BetterBattery =
new(PowerModeEnum.BetterBattery, PowerModeIds.BetterBattery);
public static readonly PowerMode Balanced =
new(PowerModeEnum.Balanced, PowerModeIds.Balanced);
public static readonly PowerMode BestPerformance =
new(PowerModeEnum.BestPerformance, PowerModeIds.BestPerformance);
public static PowerMode GuidToPowerMode(Guid guid)
{
if (guid == PowerModeIds.BetterBattery)
{
return BetterBattery;
}
if (guid == PowerModeIds.Balanced)
{
return Balanced;
}
if (guid == PowerModeIds.BestPerformance)
{
return BestPerformance;
}
throw new ArgumentOutOfRangeException($"Power mode guid {guid} is invalid!");
}
public override string ToString()
{
return $"{Mode}";
}
}