PanelLogin.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. namespace ErgometerApplication
  8. {
  9. public class PanelLogin:Panel
  10. {
  11. private System.Windows.Forms.Label lblUsername;
  12. private System.Windows.Forms.Label lblPassword;
  13. public System.Windows.Forms.Label lblVerification;
  14. public System.Windows.Forms.TextBox textBoxPassword;
  15. public System.Windows.Forms.TextBox textBoxUsername;
  16. public System.Windows.Forms.Button buttonLogin;
  17. private System.Windows.Forms.Label lblLoginTitle;
  18. private System.Windows.Forms.PictureBox pictureBoxBike;
  19. private ClientApplicatie app;
  20. public PanelLogin(ClientApplicatie app):base()
  21. {
  22. this.app = app;
  23. this.pictureBoxBike = new System.Windows.Forms.PictureBox();
  24. this.buttonLogin = new System.Windows.Forms.Button();
  25. this.textBoxPassword = new System.Windows.Forms.TextBox();
  26. this.textBoxUsername = new System.Windows.Forms.TextBox();
  27. this.lblLoginTitle = new System.Windows.Forms.Label();
  28. this.lblUsername = new System.Windows.Forms.Label();
  29. this.lblPassword = new System.Windows.Forms.Label();
  30. this.lblVerification = new System.Windows.Forms.Label();
  31. ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBike)).BeginInit();
  32. //
  33. // panelLogin
  34. //
  35. this.Controls.Add(this.pictureBoxBike);
  36. this.Controls.Add(this.buttonLogin);
  37. this.Controls.Add(this.textBoxUsername);
  38. this.Controls.Add(this.textBoxPassword);
  39. this.Controls.Add(this.lblLoginTitle);
  40. this.Controls.Add(this.lblUsername);
  41. this.Controls.Add(this.lblPassword);
  42. this.Controls.Add(this.lblVerification);
  43. this.Dock = System.Windows.Forms.DockStyle.Fill;
  44. this.Location = new System.Drawing.Point(0, 0);
  45. this.Name = "panelLogin";
  46. this.Size = new System.Drawing.Size(800, 600);
  47. this.TabIndex = 0;
  48. //
  49. // pictureBoxBike
  50. //
  51. this.pictureBoxBike.Anchor = System.Windows.Forms.AnchorStyles.None;
  52. this.pictureBoxBike.Image = global::ErgometerApplication.Properties.Resources.flatbike;
  53. this.pictureBoxBike.Location = new System.Drawing.Point(137, 131);
  54. this.pictureBoxBike.Name = "pictureBoxBike";
  55. this.pictureBoxBike.Size = new System.Drawing.Size(250, 250);
  56. this.pictureBoxBike.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
  57. this.pictureBoxBike.TabIndex = 4;
  58. this.pictureBoxBike.TabStop = false;
  59. //
  60. // buttonLogin
  61. //
  62. this.buttonLogin.Anchor = System.Windows.Forms.AnchorStyles.None;
  63. this.buttonLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  64. this.buttonLogin.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  65. this.buttonLogin.Location = new System.Drawing.Point(468, 338);
  66. this.buttonLogin.Name = "buttonLogin";
  67. this.buttonLogin.Size = new System.Drawing.Size(168, 31);
  68. this.buttonLogin.TabIndex = 3;
  69. this.buttonLogin.Text = "Aanmelden";
  70. this.buttonLogin.UseVisualStyleBackColor = true;
  71. this.buttonLogin.Click += new System.EventHandler(this.buttonLogin_Click);
  72. //
  73. // textBoxPassword
  74. //
  75. this.textBoxPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
  76. this.textBoxPassword.Location = new System.Drawing.Point(467, 287);
  77. this.textBoxPassword.MaxLength = 16;
  78. this.textBoxPassword.Name = "textBoxPassword";
  79. this.textBoxPassword.PasswordChar = '*';
  80. this.textBoxPassword.Size = new System.Drawing.Size(167, 20);
  81. this.textBoxPassword.TabIndex = 2;
  82. this.textBoxPassword.KeyDown += TextBoxPassword_KeyDown;
  83. //
  84. // textBoxUsername
  85. //
  86. this.textBoxUsername.Anchor = System.Windows.Forms.AnchorStyles.None;
  87. this.textBoxUsername.Location = new System.Drawing.Point(468, 231);
  88. this.textBoxUsername.MaxLength = 16;
  89. this.textBoxUsername.Name = "textBoxUsername";
  90. this.textBoxUsername.Size = new System.Drawing.Size(167, 20);
  91. this.textBoxUsername.TabIndex = 2;
  92. this.textBoxUsername.KeyDown += TextBoxPassword_KeyDown;
  93. //
  94. // lblLoginTitle
  95. //
  96. this.lblLoginTitle.Anchor = System.Windows.Forms.AnchorStyles.None;
  97. this.lblLoginTitle.AutoSize = true;
  98. this.lblLoginTitle.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  99. this.lblLoginTitle.Location = new System.Drawing.Point(461, 141);
  100. this.lblLoginTitle.Name = "lblLoginTitle";
  101. this.lblLoginTitle.Size = new System.Drawing.Size(87, 32);
  102. this.lblLoginTitle.TabIndex = 1;
  103. this.lblLoginTitle.Text = "Log In";
  104. //
  105. // lblVerification
  106. //
  107. this.lblVerification.Anchor = System.Windows.Forms.AnchorStyles.None;
  108. this.lblVerification.AutoSize = true;
  109. this.lblVerification.Font = new System.Drawing.Font("Segoe UI Light", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  110. this.lblVerification.Location = new System.Drawing.Point(140, 415);
  111. this.lblVerification.Name = "lvlVerification";
  112. this.lblVerification.Size = new System.Drawing.Size(200, 21);
  113. this.lblVerification.TabIndex = 1;
  114. this.lblVerification.Text = "Verification label";
  115. this.lblVerification.Visible = false;
  116. //
  117. // lblUsername
  118. //
  119. this.lblUsername.Anchor = System.Windows.Forms.AnchorStyles.None;
  120. this.lblUsername.AutoSize = true;
  121. this.lblUsername.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  122. this.lblUsername.Location = new System.Drawing.Point(464, 207);
  123. this.lblUsername.Name = "lblUsername";
  124. this.lblUsername.Size = new System.Drawing.Size(128, 21);
  125. this.lblUsername.TabIndex = 1;
  126. this.lblUsername.Text = "Gebruikersnaam";
  127. //
  128. // lblPassword
  129. //
  130. this.lblPassword.Anchor = System.Windows.Forms.AnchorStyles.None;
  131. this.lblPassword.AutoSize = true;
  132. this.lblPassword.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold);
  133. this.lblPassword.Location = new System.Drawing.Point(464, 263);
  134. this.lblPassword.Name = "lblPassword";
  135. this.lblPassword.Size = new System.Drawing.Size(103, 21);
  136. this.lblPassword.TabIndex = 0;
  137. this.lblPassword.Text = "Wachtwoord";
  138. ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBike)).EndInit();
  139. }
  140. private void TextBoxPassword_KeyDown(object sender, KeyEventArgs e)
  141. {
  142. if (e.KeyCode == Keys.Enter)
  143. {
  144. buttonLogin_Click(this, new EventArgs());
  145. }
  146. }
  147. public void buttonLogin_Click(object sender, EventArgs e)
  148. {
  149. string username = textBoxUsername.Text;
  150. string password = textBoxPassword.Text;
  151. this.app.validateLogin(username,password);
  152. }
  153. }
  154. }