Generic.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.Data;
  2. using Terminal.Gui;
  3. namespace UICatalog.Scenarios {
  4. [ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")]
  5. [ScenarioCategory ("Controls")]
  6. public class MyScenario : Scenario {
  7. public override void Init (ColorScheme colorScheme)
  8. {
  9. // The base `Scenario.Init` implementation:
  10. // - Calls `Application.Init ()`
  11. // - Adds a full-screen Window to Application.Top with a title
  12. // that reads "Press <hotkey> to Quit". Access this Window with `this.Win`.
  13. // - Sets the ColorScheme property of `this.Win` to `colorScheme`.
  14. // To overrride this, implement an override of `Init`.
  15. base.Init (colorScheme);
  16. // A common, alternate, implementation where `this.Win` is not used:
  17. // Application.Init ();
  18. // Application.Top.ColorScheme = colorScheme;
  19. }
  20. public override void Setup ()
  21. {
  22. // Put your scenario code here, e.g.
  23. var button = new Button ("Press me!") {
  24. X = Pos.Center (),
  25. Y = Pos.Center (),
  26. };
  27. button.Clicked += () => MessageBox.Query (20, 7, "Hi", "Neat?", "Yes", "No");
  28. Win.Add (button);
  29. }
  30. }
  31. }