This commit is contained in:
Serge
2024-03-31 11:54:56 +02:00
parent 822391c98f
commit efa2f0760a
2 changed files with 30 additions and 4 deletions

View File

@@ -1,4 +1,7 @@
namespace GHelper.Battery
using GHelper.Helpers;
using System.Diagnostics;
namespace GHelper.Battery
{
internal class BatteryControl
{
@@ -42,5 +45,30 @@
Program.settingsForm.VisualiseBattery(limit);
}
public static void BatteryReport()
{
var reportDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
try
{
var cmd = new Process();
cmd.StartInfo.WorkingDirectory = reportDir;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.FileName = "powershell";
cmd.StartInfo.Arguments = "powercfg /batteryreport";
cmd.Start();
cmd.StartInfo.FileName = "explorer";
cmd.StartInfo.Arguments = "battery-report.html";
cmd.Start();
}
catch (Exception ex)
{
Logger.WriteLine(ex.Message);
}
}
}
}