diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index 9536d650..0ad8a032 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -412,7 +412,7 @@ namespace GHelper comboBoost.ButtonColor = Color.FromArgb(255, 255, 255); comboBoost.DropDownStyle = ComboBoxStyle.DropDownList; comboBoost.FormattingEnabled = true; - comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive" }); + comboBoost.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive", "Aggressive at Guaranteed", "Efficient at Guaranteed" }); comboBoost.Location = new Point(226, 10); comboBoost.Name = "comboBoost"; comboBoost.Size = new Size(287, 40); diff --git a/app/InputDispatcher.cs b/app/InputDispatcher.cs index bd9fe018..612f19a8 100644 --- a/app/InputDispatcher.cs +++ b/app/InputDispatcher.cs @@ -242,21 +242,21 @@ namespace GHelper case Keys.F7: if (AppConfig.ContainsModel("TUF")) Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(-10) + "%", ToastIcon.BrightnessDown); - HandleEvent(16); + HandleOptimizationEvent(16); break; case Keys.F8: if (AppConfig.ContainsModel("TUF")) Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, ScreenBrightness.Adjust(+10) + "%", ToastIcon.BrightnessUp); - HandleEvent(32); + HandleOptimizationEvent(32); break; case Keys.F9: KeyboardHook.KeyWinPress(Keys.P); break; case Keys.F10: - HandleEvent(107); + HandleOptimizationEvent(107); break; case Keys.F11: - HandleEvent(108); + HandleOptimizationEvent(108); break; case Keys.F12: KeyboardHook.KeyWinPress(Keys.A); @@ -343,10 +343,10 @@ namespace GHelper } break; case "brightness_up": - HandleEvent(32); + HandleOptimizationEvent(32); break; case "brightness_down": - HandleEvent(16); + HandleOptimizationEvent(16); break; case "custom": CustomKey(name); @@ -429,10 +429,17 @@ namespace GHelper return; } - if (OptimizationService.IsRunning()) return; + if (!OptimizationService.IsRunning()) + + HandleOptimizationEvent(EventID); // Asus Optimization service Events + + } + + static void HandleOptimizationEvent(int EventID) + { switch (EventID) { case 16: // FN+F7 @@ -449,14 +456,7 @@ namespace GHelper case 108: // FN+F11 Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep"); break; - case 106: // Zephyrus DUO special key for turning on/off second display. - //Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_DUO_SecondDisplay, "SecondDisplay"); - break; - case 75: // Zephyrus DUO special key for changing between arrows and pgup/pgdn - //Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_DUO_PgUpDn, "PgUpDown"); - break; } - } diff --git a/app/NativeMethods.cs b/app/NativeMethods.cs index 4836039a..32f4e546 100644 --- a/app/NativeMethods.cs +++ b/app/NativeMethods.cs @@ -724,6 +724,14 @@ public class NativeMethods int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero); Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet)); + //Fallback scenario + if (iRet != 0) + { + Thread.Sleep(300); + iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero); + Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet)); + } + return iRet; } diff --git a/app/Updates.cs b/app/Updates.cs index 9a1d06fb..5bec0c9f 100644 --- a/app/Updates.cs +++ b/app/Updates.cs @@ -145,7 +145,7 @@ namespace GHelper driver.hardwares = file.GetProperty("HardwareInfoList"); drivers.Add(driver); - BeginInvoke(delegate + Invoke(delegate { string versionText = driver.version.Replace("latest version at the ", ""); Label versionLabel = new Label { Text = versionText, Anchor = AnchorStyles.Left, AutoSize = true }; @@ -170,7 +170,7 @@ namespace GHelper } } - BeginInvoke(delegate + Invoke(delegate { table.Visible = true; ResumeLayout(false); @@ -206,7 +206,7 @@ namespace GHelper var label = table.GetControlFromPosition(2, count) as Label; if (label != null) { - BeginInvoke(delegate + Invoke(delegate { label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold); label.ForeColor = colorTurbo;