mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Register for device listener on startup
This commit is contained in:
@@ -4,6 +4,7 @@ using GHelper.Gpu;
|
|||||||
using GHelper.Helpers;
|
using GHelper.Helpers;
|
||||||
using GHelper.Input;
|
using GHelper.Input;
|
||||||
using GHelper.Mode;
|
using GHelper.Mode;
|
||||||
|
using GHelper.Peripherals;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Ryzen;
|
using Ryzen;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -108,6 +109,9 @@ namespace GHelper
|
|||||||
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(settingsForm.Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
unRegPowerNotify = NativeMethods.RegisterPowerSettingNotification(settingsForm.Handle, settingGuid.ConsoleDisplayState, NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||||
|
|
||||||
|
|
||||||
|
Task task = Task.Run((Action)PeripheralsProvider.DetectAllAsusMice);
|
||||||
|
PeripheralsProvider.RegisterForDeviceEvents();
|
||||||
|
|
||||||
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
|
if (Environment.CurrentDirectory.Trim('\\') == Application.StartupPath.Trim('\\') || action.Length > 0)
|
||||||
{
|
{
|
||||||
SettingsToggle(action);
|
SettingsToggle(action);
|
||||||
@@ -241,6 +245,7 @@ namespace GHelper
|
|||||||
static void OnExit(object sender, EventArgs e)
|
static void OnExit(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
trayIcon.Visible = false;
|
trayIcon.Visible = false;
|
||||||
|
PeripheralsProvider.UnregisterForDeviceEvents();
|
||||||
clamshellControl.UnregisterDisplayEvents();
|
clamshellControl.UnregisterDisplayEvents();
|
||||||
NativeMethods.UnregisterPowerSettingNotification(unRegPowerNotify);
|
NativeMethods.UnregisterPowerSettingNotification(unRegPowerNotify);
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
|
|||||||
Reference in New Issue
Block a user