mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Init
This commit is contained in:
@@ -223,6 +223,8 @@ public class AsusACPI
|
|||||||
return _connected;
|
return _connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ManagementEventWatcher? watcher;
|
||||||
|
|
||||||
public AsusACPI()
|
public AsusACPI()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -747,10 +749,14 @@ public class AsusACPI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
if (watcher is null)
|
||||||
|
{
|
||||||
|
watcher = new ManagementEventWatcher();
|
||||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||||
watcher.Scope = new ManagementScope("root\\wmi");
|
watcher.Scope = new ManagementScope("root\\wmi");
|
||||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||||
|
}
|
||||||
|
|
||||||
watcher.Start();
|
watcher.Start();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ namespace GHelper.Input
|
|||||||
byte[] result = Program.acpi.DeviceInit();
|
byte[] result = Program.acpi.DeviceInit();
|
||||||
Debug.WriteLine($"Init: {BitConverter.ToString(result)}");
|
Debug.WriteLine($"Init: {BitConverter.ToString(result)}");
|
||||||
|
|
||||||
Program.acpi.SubscribeToEvents(WatcherEventArrived);
|
|
||||||
//Task.Run(Program.acpi.RunListener);
|
|
||||||
|
|
||||||
hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(KeyPressed);
|
hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(KeyPressed);
|
||||||
|
|
||||||
RegisterKeys();
|
RegisterKeys();
|
||||||
@@ -83,6 +80,8 @@ namespace GHelper.Input
|
|||||||
else
|
else
|
||||||
Logger.WriteLine("Optimization service is running");
|
Logger.WriteLine("Optimization service is running");
|
||||||
|
|
||||||
|
Program.acpi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
InitBacklightTimer();
|
InitBacklightTimer();
|
||||||
|
|
||||||
if (AppConfig.ContainsModel("VivoBook")) Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ? 1 : 0, "FnLock");
|
if (AppConfig.ContainsModel("VivoBook")) Program.acpi.DeviceSet(AsusACPI.FnLock, AppConfig.Is("fn_lock") ? 1 : 0, "FnLock");
|
||||||
|
|||||||
Reference in New Issue
Block a user