More cleanup

This commit is contained in:
Serge
2023-06-26 16:46:15 +02:00
parent 164d417b06
commit d0d44c3ef1
32 changed files with 738 additions and 726 deletions

View File

@@ -1,3 +1,6 @@
using GHelper.Gpu;
using GHelper.Helpers;
using GHelper.Input;
using GHelper.Mode;
using Microsoft.Win32;
using Ryzen;
@@ -22,13 +25,14 @@ namespace GHelper
public static SettingsForm settingsForm = new SettingsForm();
public static ModeControl modeControl = new ModeControl();
public static GPUModeControl gpuControl = new GPUModeControl();
public static IntPtr unRegPowerNotify;
private static long lastAuto;
private static long lastTheme;
public static InputDispatcher inputDispatcher;
public static InputDispatcher? inputDispatcher;
private static PowerLineStatus isPlugged = SystemInformation.PowerStatus.PowerLineStatus;
@@ -50,8 +54,6 @@ namespace GHelper
Thread.CurrentThread.CurrentUICulture = culture;
}
Debug.WriteLine(CultureInfo.CurrentUICulture);
ProcessHelper.CheckAlreadyRunning();
try
@@ -78,15 +80,12 @@ namespace GHelper
HardwareControl.RecreateGpuControl();
RyzenControl.Init();
var ds = settingsForm.Handle;
trayIcon.MouseClick += TrayIcon_MouseClick;
inputDispatcher = new InputDispatcher();
settingsForm.InitAura();
settingsForm.InitMatrix();
settingsForm.SetStartupCheck(Startup.IsScheduled());
SetAutoModes();
@@ -97,7 +96,7 @@ namespace GHelper
// Subscribing for monitor power on events
PowerSettingGuid settingGuid = new NativeMethods.PowerSettingGuid();
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(ds, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(settingsForm.Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
@@ -155,11 +154,11 @@ namespace GHelper
settingsForm.SetBatteryChargeLimit(AppConfig.Get("charge_limit"));
modeControl.AutoPerformance(powerChanged);
bool switched = settingsForm.AutoGPUMode();
bool switched = gpuControl.AutoGPUMode();
if (!switched)
{
settingsForm.InitGPUMode();
gpuControl.InitGPUMode();
settingsForm.AutoScreen();
}
@@ -204,7 +203,7 @@ namespace GHelper
settingsForm.FansToggle(1);
break;
case "gpurestart":
settingsForm.RestartGPU(false);
gpuControl.RestartGPU(false);
break;
case "services":
settingsForm.keyb = new Extra();
@@ -214,7 +213,7 @@ namespace GHelper
case "uv":
Startup.ReScheduleAdmin();
settingsForm.FansToggle(2);
//settingsForm.SetUV(); TODO
modeControl.SetUV();
break;
}
}
@@ -223,9 +222,7 @@ namespace GHelper
static void TrayIcon_MouseClick(object? sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
SettingsToggle();
}
}