diff --git a/app/Input/KeyboardListener.cs b/app/Input/KeyboardListener.cs index bbcd05e8..99169107 100644 --- a/app/Input/KeyboardListener.cs +++ b/app/Input/KeyboardListener.cs @@ -10,6 +10,8 @@ public class KeyboardListener CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); Action _handler; + static int retry = 0; + public KeyboardListener(Action KeyHandler) { _handler = KeyHandler; @@ -67,6 +69,12 @@ private void Listen() catch (Exception ex) { Logger.WriteLine($"Listener exited: {ex.Message}"); + if (retry++ < 2) + { + Thread.Sleep(300); + Logger.WriteLine($"Restarting listener {retry}"); + Listen(); + } } }