Moved action block to prevent unnecessary actions on main window toggle https://github.com/seerge/g-helper/pull/1651

This commit is contained in:
Serge
2023-11-25 19:53:54 +01:00
parent 5b2017299c
commit 3bab1a271b
2 changed files with 31 additions and 30 deletions

View File

@@ -119,7 +119,35 @@ namespace GHelper
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0) if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
{ {
SettingsToggle(action, false); SettingsToggle(false);
}
switch (action)
{
case "cpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(1);
break;
case "gpurestart":
gpuControl.RestartGPU(false);
break;
case "services":
settingsForm.extraForm = new Extra();
settingsForm.extraForm.Show();
settingsForm.extraForm.ServiesToggle();
break;
case "uv":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(2);
modeControl.SetRyzen();
break;
default:
Startup.StartupCheck();
break;
} }
Application.Run(); Application.Run();
@@ -213,7 +241,7 @@ namespace GHelper
SetAutoModes(true); SetAutoModes(true);
} }
public static void SettingsToggle(string action = "", bool checkForFocus = true, bool trayClick = false) public static void SettingsToggle(bool checkForFocus = true, bool trayClick = false)
{ {
if (settingsForm.Visible) if (settingsForm.Visible)
{ {
@@ -241,34 +269,6 @@ namespace GHelper
settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height; settingsForm.Top = Screen.FromControl(settingsForm).WorkingArea.Height - 10 - settingsForm.Height;
settingsForm.VisualiseGPUMode(); settingsForm.VisualiseGPUMode();
switch (action)
{
case "cpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle();
break;
case "gpu":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(1);
break;
case "gpurestart":
gpuControl.RestartGPU(false);
break;
case "services":
settingsForm.extraForm = new Extra();
settingsForm.extraForm.Show();
settingsForm.extraForm.ServiesToggle();
break;
case "uv":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(2);
modeControl.SetRyzen();
break;
default:
Startup.StartupCheck();
break;
}
} }
} }

View File

@@ -134,6 +134,7 @@ namespace GHelper.USB
{ {
var device = AsusHid.FindDevices(AsusHid.AURA_ID).FirstOrDefault(); var device = AsusHid.FindDevices(AsusHid.AURA_ID).FirstOrDefault();
if (device is null) return; if (device is null) return;
Logger.WriteLine($"GA402: {device.ReleaseNumberBcd} {device.ReleaseNumber}");
if (device.ReleaseNumberBcd == 22 || device.ReleaseNumberBcd == 23) isSingleColor = true; if (device.ReleaseNumberBcd == 22 || device.ReleaseNumberBcd == 23) isSingleColor = true;
} }
} }