This commit is contained in:
Serge
2024-06-28 11:15:28 +02:00
parent ac89645476
commit 95909bd951
2 changed files with 5 additions and 3 deletions

View File

@@ -208,10 +208,10 @@ namespace GHelper
public static void SetAutoModes(bool powerChanged = false, bool init = false)
public static bool SetAutoModes(bool powerChanged = false, bool init = false)
{
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 3000) return;
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastAuto) < 3000) return false;
lastAuto = DateTimeOffset.Now.ToUnixTimeMilliseconds();
isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
@@ -240,6 +240,8 @@ namespace GHelper
{
settingsForm.AutoKeyboard();
}
return true;
}
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)

View File

@@ -674,7 +674,7 @@ namespace GHelper
break;
case 1:
Logger.WriteLine("Monitor Power On");
Program.SetAutoModes();
if (!Program.SetAutoModes()) BatteryControl.AutoBattery();
break;
case 2:
Logger.WriteLine("Monitor Dimmed");