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(); } } }
private void alertButton_Click(object sender, EventArgs e) { Program.alertOpened = false; ControlStationForm.setTimeCounter(0); stopAudio(); this.Close(); }
private void AlertnessVerificationForm_FormClosing(object sender, FormClosingEventArgs e) { Program.alertOpened = false; ControlStationForm.setTimeCounter(0); stopAudio(); }