LoginView.Designer.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 
  2. using Terminal.Gui.ViewBase;
  3. using Terminal.Gui.Views;
  4. namespace CommunityToolkitExample;
  5. internal partial class LoginView : Window
  6. {
  7. private Label titleLabel;
  8. private Label usernameLengthLabel;
  9. private TextField usernameInput;
  10. private Label passwordLengthLabel;
  11. private TextField passwordInput;
  12. private Label validationLabel;
  13. private Button loginButton;
  14. private Button clearButton;
  15. private Label loginProgressLabel;
  16. private void InitializeComponent ()
  17. {
  18. titleLabel = new Label ();
  19. titleLabel.Text = "Login Form";
  20. Add (titleLabel);
  21. usernameLengthLabel = new Label ();
  22. usernameLengthLabel.X = Pos.Left (titleLabel);
  23. usernameLengthLabel.Y = Pos.Top (titleLabel) + 1;
  24. Add (usernameLengthLabel);
  25. usernameInput = new TextField ();
  26. usernameInput.X = Pos.Right (usernameLengthLabel) + 1;
  27. usernameInput.Y = Pos.Top (usernameLengthLabel);
  28. usernameInput.Width = 40;
  29. Add (usernameInput);
  30. passwordLengthLabel = new Label ();
  31. passwordLengthLabel.X = Pos.Left (usernameLengthLabel);
  32. passwordLengthLabel.Y = Pos.Top (usernameLengthLabel) + 1;
  33. Add (passwordLengthLabel);
  34. passwordInput = new TextField ();
  35. passwordInput.X = Pos.Right (passwordLengthLabel) + 1;
  36. passwordInput.Y = Pos.Top (passwordLengthLabel);
  37. passwordInput.Width = 40;
  38. passwordInput.Secret = true;
  39. Add (passwordInput);
  40. validationLabel = new Label ();
  41. validationLabel.X = Pos.Left (passwordInput);
  42. validationLabel.Y = Pos.Top (passwordInput) + 1;
  43. Add (validationLabel);
  44. loginButton = new Button ();
  45. loginButton.X = Pos.Left (validationLabel);
  46. loginButton.Y = Pos.Top (validationLabel) + 1;
  47. loginButton.Text = "_Login";
  48. Add (loginButton);
  49. clearButton = new Button ();
  50. clearButton.X = Pos.Left (loginButton);
  51. clearButton.Y = Pos.Top (loginButton) + 1;
  52. clearButton.Text = "_Clear";
  53. Add (clearButton);
  54. loginProgressLabel = new Label ();
  55. loginProgressLabel.X = Pos.Left (clearButton);
  56. loginProgressLabel.Y = Pos.Top (clearButton) + 1;
  57. loginProgressLabel.Width = 40;
  58. loginProgressLabel.Height = 1;
  59. Add (loginProgressLabel);
  60. }
  61. }