示例#1
0
        private void loginButton_click(object sender, EventArgs e)
        {
            MessageBoxButtons buttonOk = MessageBoxButtons.OK;

            string username = loginBox.Text;
            string password = passwordBox.Text;

            if (username.Equals(correctLogin) && password.Equals(correctPassword))
            {
                this.Hide();
                ControlStationForm form = new ControlStationForm();
                form.Closed += (s, args) => this.Close();
                form.Show();
            }
            else
            {
                maxAttempts--;
                MessageBox.Show("Wrong username or password. \n Try again! \n Left attempts: "
                                + maxAttempts.ToString(), "Wrong credentials", buttonOk, MessageBoxIcon.Warning);

                loginBox.Clear();
                passwordBox.Clear();
                loginBox.Focus();
                loginButton.Enabled = false;


                if (maxAttempts == 0)
                {
                    Application.Exit();
                }
            }
        }
示例#2
0
 private void alertButton_Click(object sender, EventArgs e)
 {
     Program.alertOpened = false;
     ControlStationForm.setTimeCounter(0);
     stopAudio();
     this.Close();
 }
示例#3
0
 private void AlertnessVerificationForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     Program.alertOpened = false;
     ControlStationForm.setTimeCounter(0);
     stopAudio();
 }