FakeMainLoop.cs 652 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. namespace Terminal.Gui {
  3. internal class FakeMainLoop : IMainLoopDriver {
  4. public Action<ConsoleKeyInfo> KeyPressed;
  5. public FakeMainLoop (ConsoleDriver consoleDriver = null)
  6. {
  7. // consoleDriver is not needed/used in FakeConsole
  8. }
  9. public void Setup (MainLoop mainLoop)
  10. {
  11. }
  12. public void Wakeup ()
  13. {
  14. // No implementation needed for FakeMainLoop
  15. }
  16. public bool EventsPending (bool wait)
  17. {
  18. // Always return true for FakeMainLoop
  19. return true;
  20. }
  21. public void MainIteration ()
  22. {
  23. if (FakeConsole.MockKeyPresses.Count > 0) {
  24. KeyPressed?.Invoke (FakeConsole.MockKeyPresses.Pop ());
  25. }
  26. }
  27. }
  28. }