demo.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Terminal;
  2. class Demo {
  3. static void ShowTextAlignments (View container)
  4. {
  5. container.Add (
  6. new Label (new Rect (0, 0, 40, 3), "1-Hello world, how are you doing today") { TextAlignment = TextAlignment.Left },
  7. new Label (new Rect (0, 4, 40, 3), "2-Hello world, how are you doing today") { TextAlignment = TextAlignment.Right },
  8. new Label (new Rect (0, 8, 40, 3), "3-Hello world, how are you doing today") { TextAlignment = TextAlignment.Centered },
  9. new Label (new Rect (0, 12, 40, 3), "4-Hello world, how are you doing today") { TextAlignment = TextAlignment.Justified });
  10. }
  11. static void ShowEntries (View container)
  12. {
  13. container.Add (
  14. new Label (3, 2, "Login: "),
  15. new TextField (14, 2, 40, ""),
  16. new Label (3, 4, "Password: "),
  17. new TextField (14, 4, 40, "") { Secret = true },
  18. new Button (3, 6, "Ok"),
  19. new Button (10, 6, "Cancel")
  20. );
  21. }
  22. static void Main ()
  23. {
  24. Application.Init ();
  25. var top = Application.Top;
  26. var win = new Window (new Rect (0, 0, 80, 24), "Hello");
  27. ShowEntries (win);
  28. // ShowTextAlignments (win);
  29. top.Add (win);
  30. Application.Run ();
  31. }
  32. }