private void Run() { double last_key_time = 0; DateTime UNIX_EPOCH = new DateTime(1970, 1, 1); while (running) { ConsoleKeyInfo key = Console.ReadKey(true); DebugLog.LogComponent("Handling KEY: " + key.Key); if (Container != null) { double current_millis = (DateTime.UtcNow - UNIX_EPOCH).TotalMilliseconds; if (current_millis - last_key_time > KEY_DELAY) { Container.OnKeyPressed(this, new ConsoleKeyEventArgs(key)); last_key_time = current_millis; } } else { DebugLog.LogComponent("Warning: RootContainer is null"); } if (ExitKey != 0 && key.Key == ExitKey) { running = false; } } }