/** * Login Method to handle Login Button * @param object sender * @param RoutedEventArgs e */ private void btnLogin_Click(object sender, RoutedEventArgs e) { ApiOperations ops = new ApiOperations(); string username = tbxUsername.Text; string password = pbxPassword.Password; // Kan slettes, bruges blot til test if (ops.CheckIfAdmin(username, password)) { ShowMainMenu(); return; } //NavigationService.Navigate(new MainWindow()); User user = ops.AuthenticateUser(username, password); if (user == null) { MessageBox.Show("Invalid username or password"); return; } Globals.LoggedInUser = user; // MessageBox.Show("Login successful"); ShowMainMenu(); //NavigationService.Navigate(new DetailsPage()); //her indsættes kode til at åbne MainWindow }
/** * Login Method to handle Login Button * @param object sender * @param RoutedEventArgs e */ private void btnLogin_Click(object sender, RoutedEventArgs e) { string username = tbxUsername.Text; string password = pbxPassword.Password; ApiOperations ops = new ApiOperations(); User user = ops.AuthenticateUser(username, password); if (user == null) { MessageBox.Show("Invalid username or password"); return; } Globals.LoggedInUser = user; MessageBox.Show("Login successful"); NavigationService.Navigate(new DetailsPage()); }