/// <summary> /// Open the manage employees page on correct login /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuManageEmployees_Click(object sender, RoutedEventArgs e) { AdminLoginView login = new AdminLoginView(); login.LoginSuccessful += loginSuccessful_OpenEmployee; // Add loginsuccessful event trigger login.ShowDialog(); // Opens the login view }
/// <summary> /// Creates the adminLoginView. The user can login with this view. If the password is correct, login. /// If not, show error and rerun this method. /// </summary> public void OpenAdminLoginWindow() { using (AdminLoginView adminLoginView = new AdminLoginView()) { TextBox wachtwoordTxtBox = adminLoginView.wachtwoordTxtBox; DialogResult result = adminLoginView.ShowDialog(); if (result == DialogResult.OK) { //Hard coded YOLO if (wachtwoordTxtBox.Text == "admin") { LogInAdmin(); } else { MessageBox.Show("U heeft een verkeerd wachtwoord ingevoerd, probeer het opnieuw!"); OpenAdminLoginWindow(); } } } }