private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (result) { MessageBox.Show("Success"); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel.Show(); SlidePanel2.Hide(); SlidePanel3.Hide(); panel4.BackColor = Color.Gainsboro; panel6.BackColor = Color.WhiteSmoke; panel2.BackColor = Color.WhiteSmoke; lblStatus.ForeColor = Color.Green; lblStatus.Visible = true; lblStatus.Text = "Done"; } else { MessageBox.Show("Could not update your password"); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel.Show(); SlidePanel2.Hide(); SlidePanel3.Hide(); panel4.BackColor = Color.Gainsboro; panel6.BackColor = Color.WhiteSmoke; panel2.BackColor = Color.WhiteSmoke; lblStatus.ForeColor = Color.Red; lblStatus.Visible = true; lblStatus.Text = "Error"; } }
private void textBox2_Enter(object sender, EventArgs e) { SlidePanel.Hide(); SlidePanel3.Hide(); panel4.BackColor = Color.WhiteSmoke; panel2.BackColor = Color.WhiteSmoke; textBox2.Clear(); panel6.BackColor = Color.Gainsboro; SlidePanel2.Show(); textBox2.Clear(); textBox2.ForeColor = SystemColors.WindowText; if (String.IsNullOrEmpty(textBox1.Text)) { textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; } if (String.IsNullOrEmpty(textBox3.Text)) { textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; } }
public ChangePasswordForm() { InitializeComponent(); textBox1.ForeColor = SystemColors.GrayText; textBox1.Text = "Username"; textBox2.ForeColor = SystemColors.GrayText; textBox2.Text = "Old password"; textBox3.ForeColor = SystemColors.GrayText; textBox3.Text = "New password"; SlidePanel2.Hide(); SlidePanel3.Hide(); list = new List <User>(); result = false; bgWorker.DoWork += bgWorker_DoWork; bgWorker.ProgressChanged += bgWorker_ProgressChanged; bgWorker.RunWorkerCompleted += bgWorker_RunWorkerCompleted; }