FakeMainLoop.cs 664 B

12345678910111213141516171819202122232425262728293031323334353637
  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. // No implementation needed for FakeMainLoop
  8. }
  9. public void Setup (MainLoop mainLoop)
  10. {
  11. // No implementation needed for FakeMainLoop
  12. }
  13. public void Wakeup ()
  14. {
  15. // No implementation needed for FakeMainLoop
  16. }
  17. public bool EventsPending (bool wait)
  18. {
  19. // Always return true for FakeMainLoop
  20. return true;
  21. }
  22. public void Iteration ()
  23. {
  24. if (FakeConsole.MockKeyPresses.Count > 0) {
  25. KeyPressed?.Invoke (FakeConsole.MockKeyPresses.Pop ());
  26. }
  27. }
  28. }