Advertisement
Guest User

Untitled

a guest
Feb 11th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11.  
  12. namespace GymFucker
  13. {
  14.     public partial class frmLogin : Form
  15.     {
  16.         public frmLogin()
  17.         {
  18.             InitializeComponent();
  19.             Init_Data();
  20.         }
  21.         private void frmLogin_Load(object sender, EventArgs e)
  22.         {        
  23.         }
  24.         private void btnLogin_Click(object sender, EventArgs e)
  25.         {
  26.             String username = txtUsername.Text.Trim();
  27.             String password = txtPassword.Text;
  28.             chbxRememberMe.Enabled = true;
  29.            
  30.             if (username.Equals("EinfachNurYannick")) {
  31.  
  32.                 if (password.Equals("ayy"))
  33.                 {
  34.                     Save_Data();
  35.                     btnLogin.Enabled = false;
  36.                     txtUsername.Enabled = false;
  37.                     txtPassword.Enabled = false;
  38.  
  39.                     timer1.Start();
  40.                 } else {
  41.  
  42.                     MessageBox.Show("The Password is incorrect!");
  43.                 }
  44.  
  45.                } else
  46.             {
  47.                 MessageBox.Show("The Username is incorrect!");
  48.             }
  49.         }
  50.  
  51.         private void btnCancel_Click(object sender, EventArgs e)
  52.         {
  53.             Close();
  54.         }
  55.  
  56.         private void btnClose_Click(object sender, EventArgs e)
  57.         {
  58.             Close();
  59.         }
  60.  
  61.         private void timer1_Tick(object sender, EventArgs e)
  62.         {
  63.            
  64.             if (prgLoad.Value < 100)
  65.             {
  66.                 prgLoad.Value++;
  67.              }
  68.  
  69.             if (prgLoad.Value > 0 && prgLoad.Value < 10)
  70.             {
  71.                 lblTitel.ForeColor = Color.AliceBlue;
  72.                 lblStatusText.Text = "Is Loading..";
  73.             }
  74.             if (prgLoad.Value > 10 && prgLoad.Value < 20)
  75.             {
  76.                 lblTitel.ForeColor = Color.Red;
  77.             }
  78.             if (prgLoad.Value > 20 && prgLoad.Value < 30)
  79.             {
  80.                 lblTitel.ForeColor = Color.Green;
  81.             }
  82.             if (prgLoad.Value > 30 && prgLoad.Value < 40)
  83.             {
  84.                 lblTitel.ForeColor = Color.BlueViolet;
  85.                 lblStatusText.Text = "Loading Modules..";
  86.                 lblStatusText.ForeColor = Color.PaleVioletRed;
  87.                 prgLoad.ForeColor = Color.PaleVioletRed;
  88.             }
  89.             if (prgLoad.Value > 40 && prgLoad.Value < 50)
  90.             {
  91.                 lblTitel.ForeColor = Color.Gray;
  92.             }
  93.             if (prgLoad.Value > 50 && prgLoad.Value < 60)
  94.             {
  95.                 lblTitel.ForeColor = Color.LemonChiffon;
  96.             }
  97.             if (prgLoad.Value > 60 && prgLoad.Value < 70)
  98.             {
  99.                 lblTitel.ForeColor = Color.LimeGreen;
  100.                 lblStatusText.Text = "Finished Programm";
  101.                 lblStatusText.ForeColor = Color.ForestGreen;
  102.                 prgLoad.ForeColor = Color.ForestGreen;
  103.             }
  104.             if (prgLoad.Value > 70 && prgLoad.Value < 80)
  105.             {
  106.                 lblTitel.ForeColor = Color.Gold;
  107.             }
  108.             if (prgLoad.Value > 80 && prgLoad.Value < 90)
  109.             {
  110.                 lblTitel.ForeColor = Color.LightSkyBlue;
  111.             }
  112.             if (prgLoad.Value > 90 && prgLoad.Value < 100)
  113.             {
  114.                 lblTitel.ForeColor = Color.Lime;
  115.             }
  116.             if (prgLoad.Value == 100)
  117.             {
  118.                 timer1.Enabled = false;
  119.                 frmMain loader = new frmMain();
  120.                 loader.Show();
  121.                 this.Hide();
  122.             }
  123.             lblStatusProcent.Text = prgLoad.Value + "%";
  124.         }
  125.  
  126.         private void pictureBox1_Click(object sender, EventArgs e)
  127.         {
  128.  
  129.         }
  130.  
  131.         private void pictureBox1_Click_1(object sender, EventArgs e)
  132.         {
  133.             Close();
  134.         }
  135.  
  136.         private void label1_Click(object sender, EventArgs e)
  137.         {
  138.  
  139.         }
  140.  
  141.         private void Init_Data()
  142.         {
  143.             if (Properties.Settings.Default.UserName != string.Empty)
  144.             {
  145.                 if (Properties.Settings.Default.Remme == "yes")
  146.                 {
  147.                     txtUsername.Text = Properties.Settings.Default.UserName;
  148.                     txtPassword.Text = Properties.Settings.Default.Password;
  149.                     chbxRememberMe.Checked = true;
  150.                 } else
  151.                 {
  152.                     txtUsername.Text = Properties.Settings.Default.UserName;
  153.                 }
  154.             }
  155.         }
  156.                
  157.         private void Save_Data()
  158.         {
  159.             if (chbxRememberMe.Checked)
  160.             {
  161.                 Properties.Settings.Default.UserName = txtUsername.Text.Trim();
  162.                 Properties.Settings.Default.Password = txtPassword.Text;
  163.                 Properties.Settings.Default.Remme = "yes";
  164.                 Properties.Settings.Default.Save();  
  165.                    } else
  166.             {
  167.                 Properties.Settings.Default.UserName = txtUsername.Text.Trim();
  168.                 Properties.Settings.Default.Password = "";
  169.                 Properties.Settings.Default.Remme = "no";
  170.                 Properties.Settings.Default.Save();
  171.             }
  172.         }
  173.            
  174.  
  175.  
  176.     }
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement