SystemConsole.cs 836 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Terminal.Gui;
  2. namespace UICatalog {
  3. [ScenarioMetadata (Name: "System Console", Description: "Not working - #518 - Enables System Console and exercises things")]
  4. [ScenarioCategory ("Bug Repro")]
  5. [ScenarioCategory ("Console")]
  6. class UseSystemConsole : Scenario {
  7. public override void Init (Toplevel top, ColorScheme colorScheme)
  8. {
  9. Application.UseSystemConsole = true;
  10. base.Init (top, colorScheme);
  11. }
  12. public override void RequestStop ()
  13. {
  14. base.RequestStop ();
  15. Application.UseSystemConsole = false;
  16. }
  17. public override void Run ()
  18. {
  19. base.Run ();
  20. }
  21. public override void Setup ()
  22. {
  23. var pressMe = new Button ("Press me!") {
  24. X = Pos.Center (),
  25. Y = Pos.Center (),
  26. };
  27. pressMe.Clicked += () => MessageBox.Query (20, 7, "Hi", "Neat?", "Yes", "No");
  28. Win.Add (pressMe);
  29. }
  30. }
  31. }