This commit is contained in:
Serge
2024-01-15 09:06:08 +01:00
parent 6e1081044b
commit 0270a453b8

View File

@@ -12,7 +12,7 @@ namespace GHelper.Input
public KeyboardListener(Action<int> KeyHandler) public KeyboardListener(Action<int> KeyHandler)
{ {
_handler = KeyHandler; _handler = KeyHandler;
Listen(); var task = Task.Run(Listen);
} }
private void Listen () { private void Listen () {
@@ -23,10 +23,10 @@ namespace GHelper.Input
int count = 0; int count = 0;
while (input == null && count++ < 60) while (input == null && count++ < 5)
{ {
Aura.Init(); Aura.Init();
Thread.Sleep(1000); Thread.Sleep(2000);
input = AsusHid.FindHidStream(AsusHid.INPUT_ID); input = AsusHid.FindHidStream(AsusHid.INPUT_ID);
} }
@@ -38,8 +38,6 @@ namespace GHelper.Input
Logger.WriteLine($"Input: {input.Device.DevicePath}"); Logger.WriteLine($"Input: {input.Device.DevicePath}");
var task = Task.Run(() =>
{
try try
{ {
while (!cancellationTokenSource.Token.IsCancellationRequested) while (!cancellationTokenSource.Token.IsCancellationRequested)
@@ -69,8 +67,6 @@ namespace GHelper.Input
{ {
Logger.WriteLine(ex.ToString()); Logger.WriteLine(ex.ToString());
} }
});
} }