FakeMainLoop.cs 724 B

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