internal async Task PollThreadAsync(int PollRate = 30, DlgOnKeyPolled OnKeyPolled = null) { while (true) { await WaitForPolledKeypressAsync(PollRate).ConfigureAwait(false); OnKeyPolled?.Invoke(); } // ReSharper disable once FunctionNeverReturns }
internal void ManuallyPolledThread(int PollRate = 30, DlgOnKeyPolled OnKeyPolled = null) { while (true) { Thread.Sleep(PollRate); KeyboardState State = GetKeyboardState(); if (State.PressedKeys.Contains(MonitoredKey)) { OnKeyPolled?.Invoke(); } } // ReSharper disable once FunctionNeverReturns }
internal async Task StateThreadAsync(int PollRate = 30, DlgOnKeyPolled OnKeyPolled = null) { List <Key> PressedKeys = new List <Key>(); while (true) { bool Success; (PressedKeys, Success) = await WaitForStateKeypressAsync(PressedKeys, PollRate).ConfigureAwait(false); if (Success) { OnKeyPolled?.Invoke(); } } // ReSharper disable once FunctionNeverReturns }