private void exit_Button_Click(object sender, EventArgs e) { var exitBox = new CustomMessageBox_Form(); exitBox.ShowMessage(ConfirmExitMessage, ConfirmExitCaption, NoButton, YesButton); if (exitBox.DialogResult == DialogResult.Yes) { this.Close(); } else { return; } }
//public event EventHandler UserLoggedIn; private void AttemptLogin() { using (entity = new ScheduleEntities()) { var errorBox = new CustomMessageBox_Form(); var userQuery = from u in entity.users where u.userName == username_TextBox.Text select u; if (userQuery.Count() == 1) {//Check to see if selected User has correct password. var sUser = userQuery.First(); if (sUser.userName == username_TextBox.Text && sUser.password == password_TextBox.Text) {//Set this user as one to be tracked, then open up this user's account menu. UserTracker.GetUser(sUser); var userMenu = new UserMenu_Form(); userMenu.ExitClicked += new EventHandler(userMenu_Form_ExitClicked); userMenu.Show(); TrackLogins.SaveToLogFile(); this.Hide(); } else { errorBox.ShowMessage(CredentialsDontMatch, LoginFailed, OkButton); return; } } else { errorBox.ShowMessage(InvalidUsername, LoginFailed, OkButton); return; } } }