From b46f0fb887f537ae6985910de10cb4325cd45f23 Mon Sep 17 00:00:00 2001 From: seerge Date: Mon, 13 Mar 2023 11:38:54 +0100 Subject: [PATCH] Removed scheduler call on each run --- NativeMethods.cs | 2 +- Program.cs | 4 ++++ Settings.cs | 2 ++ Startup.cs | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NativeMethods.cs b/NativeMethods.cs index 4efb9c5f..88d93d09 100644 --- a/NativeMethods.cs +++ b/NativeMethods.cs @@ -485,7 +485,7 @@ public class NativeMethods try { - var devices = GetAllDevices(); + var devices = GetAllDevices().ToArray(); int count = 0, displayNum = -1; foreach (var device in devices) diff --git a/Program.cs b/Program.cs index b3b2eb7e..1ce96261 100644 --- a/Program.cs +++ b/Program.cs @@ -144,6 +144,10 @@ namespace GHelper case PBT_APMRESUMEAUTOMATIC: settingsForm.BeginInvoke(delegate { + // Fix for bugging buios on wake up + Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, (config.getConfig("performance_mode")+1) % 3); + Thread.Sleep(500); + SetAutoModes(); }); break; diff --git a/Settings.cs b/Settings.cs index 5dc75a53..37338e07 100644 --- a/Settings.cs +++ b/Settings.cs @@ -1028,7 +1028,9 @@ namespace GHelper public void SetStartupCheck(bool status) { + checkStartup.CheckedChanged -= CheckStartup_CheckedChanged; checkStartup.Checked = status; + checkStartup.CheckedChanged += CheckStartup_CheckedChanged; } public void SetBatteryChargeLimit(int limit) diff --git a/Startup.cs b/Startup.cs index 1f00652a..597ced1d 100644 --- a/Startup.cs +++ b/Startup.cs @@ -22,7 +22,7 @@ public class Startup var userId = WindowsIdentity.GetCurrent().Name; - //Debug.WriteLine(strExeFilePath); + Debug.WriteLine(strExeFilePath); TaskDefinition td = TaskService.Instance.NewTask(); td.RegistrationInfo.Description = "GHelper Auto Start"; td.Triggers.Add(new LogonTrigger { UserId = userId, });