Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. using System.Runtime.InteropServices;
  12.  
  13. namespace Tunestore
  14. {
  15. public partial class Form1 : Form
  16. {
  17.  
  18. //Variables
  19. string datum = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
  20. string version = " v" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + " Alpha 0.1.5";
  21.  
  22.  
  23. public Form1()
  24. {
  25. InitializeComponent();
  26.  
  27. }
  28.  
  29. #region Event Handlers
  30. private void Form1_Load(object sender, EventArgs e) //Start Application
  31. {
  32. startFormMethod();
  33. }
  34.  
  35. private void versionMenuItemTl_Click(object sender, EventArgs e) //Help > Version
  36. {
  37. versionMenuMethod();
  38. }
  39. private void aboutMenuItemTl_Click(object sender, EventArgs e) //Help > About
  40. {
  41. aboutMenuMethod();
  42. }
  43. private void btnLoginTl_Click(object sender, EventArgs e) //Login
  44. {
  45. loginMethod();
  46. }
  47. private void exitMenuItemTl_Click(object sender, EventArgs e) //File > Exit
  48. {
  49. Application.Exit();
  50. }
  51. private void openMenuItemTl_Click(object sender, EventArgs e) //File > Open
  52. {
  53.  
  54. }
  55. private void saveMenuItemTl_Click(object sender, EventArgs e) //File > Save
  56. {
  57.  
  58. }
  59. private void registerMenuItemTl_Click(object sender, EventArgs e) //Tools > Register
  60. {
  61.  
  62. }
  63. private void logoutMenuItemTl_Click(object sender, EventArgs e) //Tools > Logout
  64. {
  65. logoutMethod();
  66. }
  67. private void cbShowPassTl_CheckedChanged(object sender, EventArgs e)
  68. {
  69. showpassMethod();
  70. }
  71. #endregion Event Handlers
  72.  
  73.  
  74. #region Methods
  75. private void startFormMethod() //Start Application
  76. {
  77. tabCtrlTl.TabPages.Remove(tabpageInvTl);
  78. this.Text = "Deuntjes Winkel" + version;
  79. }
  80. private void showpassMethod()
  81. {
  82. if (cbShowPassTl.Checked)
  83. {
  84. tbPassTl.UseSystemPasswordChar = false;
  85. }
  86. else
  87. {
  88. tbPassTl.UseSystemPasswordChar = true;
  89. }
  90. }
  91. private void versionMenuMethod() //Help > Version
  92. {
  93. MessageBox.Show("Version: "+ version,
  94. "Version",
  95. MessageBoxButtons.OK,
  96. MessageBoxIcon.Information);
  97. }
  98. private void aboutMenuMethod() //Help > About
  99. {
  100. MessageBox.Show("About" +
  101. "\n\nName: \t\tTim Langen" +
  102. "\nApplication: \tTune Store" +
  103. "\nDate: \t\t" + datum +
  104. "\nSchool: \t\tROC ter AA, Helmond",
  105. "About",
  106. MessageBoxButtons.OK,
  107. MessageBoxIcon.Information);
  108. }
  109. private void loginMethod() //Login
  110. {
  111. if (tbUserTl.Text == "lorddusk")
  112. {
  113. if (tbPassTl.Text == "password")
  114. {
  115.  
  116. lblAccessTl.Text = "Access Granted!";
  117. lblAccessTl.ForeColor = Color.Green;
  118. MessageBox.Show("Login Granted", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
  119. tabCtrlTl.TabPages.Add(tabpageInvTl);
  120. tabCtrlTl.TabPages.Remove(tabpageModeTl);
  121. logoutMenuItemTl.Visible = true;
  122.  
  123.  
  124. }
  125. else
  126. {
  127. lblAccessTl.Text = "Access Denied!";
  128. lblAccessTl.ForeColor = Color.Red;
  129. MessageBox.Show("Password wrong, try again!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  130.  
  131.  
  132. }
  133.  
  134. }
  135. else
  136. {
  137. lblAccessTl.Text = "Access Denied!";
  138. lblAccessTl.ForeColor = Color.Red;
  139. MessageBox.Show("Username wrong", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  140. }
  141.  
  142. }
  143. private void logoutMethod() //Logout
  144. {
  145. tbUserTl.Text = "";
  146. tbPassTl.Text = "";
  147. tabCtrlTl.TabPages.Add(tabpageModeTl);
  148. tabCtrlTl.TabPages.Remove(tabpageInvTl);
  149. logoutMenuItemTl.Visible = false;
  150. lblAccessTl.Text = "---";
  151. lblAccessTl.ForeColor = Color.Black;
  152. MessageBox.Show("Logged out successfully", "Logging out!", MessageBoxButtons.OK, MessageBoxIcon.Information);
  153. }
  154. #endregion
  155.  
  156. }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement