Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- namespace Tunestore
- {
- public partial class Form1 : Form
- {
- //Variables
- string datum = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
- string version = " v" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + " Alpha 0.1.5";
- public Form1()
- {
- InitializeComponent();
- }
- #region Event Handlers
- private void Form1_Load(object sender, EventArgs e) //Start Application
- {
- startFormMethod();
- }
- private void versionMenuItemTl_Click(object sender, EventArgs e) //Help > Version
- {
- versionMenuMethod();
- }
- private void aboutMenuItemTl_Click(object sender, EventArgs e) //Help > About
- {
- aboutMenuMethod();
- }
- private void btnLoginTl_Click(object sender, EventArgs e) //Login
- {
- loginMethod();
- }
- private void exitMenuItemTl_Click(object sender, EventArgs e) //File > Exit
- {
- Application.Exit();
- }
- private void openMenuItemTl_Click(object sender, EventArgs e) //File > Open
- {
- }
- private void saveMenuItemTl_Click(object sender, EventArgs e) //File > Save
- {
- }
- private void registerMenuItemTl_Click(object sender, EventArgs e) //Tools > Register
- {
- }
- private void logoutMenuItemTl_Click(object sender, EventArgs e) //Tools > Logout
- {
- logoutMethod();
- }
- private void cbShowPassTl_CheckedChanged(object sender, EventArgs e)
- {
- showpassMethod();
- }
- #endregion Event Handlers
- #region Methods
- private void startFormMethod() //Start Application
- {
- tabCtrlTl.TabPages.Remove(tabpageInvTl);
- this.Text = "Deuntjes Winkel" + version;
- }
- private void showpassMethod()
- {
- if (cbShowPassTl.Checked)
- {
- tbPassTl.UseSystemPasswordChar = false;
- }
- else
- {
- tbPassTl.UseSystemPasswordChar = true;
- }
- }
- private void versionMenuMethod() //Help > Version
- {
- MessageBox.Show("Version: "+ version,
- "Version",
- MessageBoxButtons.OK,
- MessageBoxIcon.Information);
- }
- private void aboutMenuMethod() //Help > About
- {
- MessageBox.Show("About" +
- "\n\nName: \t\tTim Langen" +
- "\nApplication: \tTune Store" +
- "\nDate: \t\t" + datum +
- "\nSchool: \t\tROC ter AA, Helmond",
- "About",
- MessageBoxButtons.OK,
- MessageBoxIcon.Information);
- }
- private void loginMethod() //Login
- {
- if (tbUserTl.Text == "lorddusk")
- {
- if (tbPassTl.Text == "password")
- {
- lblAccessTl.Text = "Access Granted!";
- lblAccessTl.ForeColor = Color.Green;
- MessageBox.Show("Login Granted", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
- tabCtrlTl.TabPages.Add(tabpageInvTl);
- tabCtrlTl.TabPages.Remove(tabpageModeTl);
- logoutMenuItemTl.Visible = true;
- }
- else
- {
- lblAccessTl.Text = "Access Denied!";
- lblAccessTl.ForeColor = Color.Red;
- MessageBox.Show("Password wrong, try again!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- lblAccessTl.Text = "Access Denied!";
- lblAccessTl.ForeColor = Color.Red;
- MessageBox.Show("Username wrong", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- private void logoutMethod() //Logout
- {
- tbUserTl.Text = "";
- tbPassTl.Text = "";
- tabCtrlTl.TabPages.Add(tabpageModeTl);
- tabCtrlTl.TabPages.Remove(tabpageInvTl);
- logoutMenuItemTl.Visible = false;
- lblAccessTl.Text = "---";
- lblAccessTl.ForeColor = Color.Black;
- MessageBox.Show("Logged out successfully", "Logging out!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement