Program.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using Terminal.Gui;
  3. using Attribute = Terminal.Gui.Attribute;
  4. namespace Designer {
  5. class Surface : Window {
  6. public Surface () : base ("Designer")
  7. {
  8. }
  9. }
  10. class MainClass {
  11. static void Close ()
  12. {
  13. MessageBox.ErrorQuery (50, 7, "Error", "There is nothing to close", "Ok");
  14. }
  15. public static void Main (string [] args)
  16. {
  17. Application.Init ();
  18. var menu = new MenuBar (new MenuBarItem [] {
  19. new MenuBarItem ("_File", new MenuItem [] {
  20. new MenuItem ("_Close", "", () => Close ()),
  21. new MenuItem ("_Quit", "", () => { Application.RequestStop (); })
  22. }),
  23. new MenuBarItem ("_Edit", new MenuItem [] {
  24. new MenuItem ("_Copy", "", null),
  25. new MenuItem ("C_ut", "", null),
  26. new MenuItem ("_Paste", "", null)
  27. }),
  28. });
  29. var login = new Label ("Login: ") { X = 3, Y = 6 };
  30. var password = new Label ("Password: ") {
  31. X = Pos.Left (login),
  32. Y = Pos.Bottom (login) + 1
  33. };
  34. var surface = new Surface () {
  35. X = 0,
  36. Y = 1,
  37. Width = Dim.Percent (80),
  38. Height = Dim.Fill ()
  39. };
  40. var loginText = new TextField("") {
  41. X = Pos.Right(password),
  42. Y = Pos.Top(login),
  43. Width = 40,
  44. ColorScheme = new ColorScheme() {
  45. Focus = Attribute.Make(Color.BrightYellow, Color.DarkGray),
  46. Normal = Attribute.Make(Color.Green, Color.BrightYellow),
  47. HotFocus = Attribute.Make(Color.BrightBlue, Color.Brown),
  48. HotNormal = Attribute.Make(Color.Red, Color.BrightRed),
  49. },
  50. };
  51. var passText = new TextField ("") {
  52. Secret = true,
  53. X = Pos.Left (loginText),
  54. Y = Pos.Top (password),
  55. Width = Dim.Width (loginText)
  56. };
  57. surface.Add (login, password, loginText, passText);
  58. Application.Top.Add (menu, surface);
  59. Application.Run ();
  60. }
  61. }
  62. }