private void CreateNewUserButton_Click(object sender, RoutedEventArgs e) { string username = UsernameTextBox.Text; string password = PasswordTextbox.Text; bool isManager = IsManagerCheckBox.IsChecked == true; // Add new user to db then login as new user User newUser = DatabaseHandler.getInstance().addNewUser(username, password, isManager); MainWindow2 loggedInWindow = new MainWindow2(newUser); loggedInWindow.Show(); this.Close(); }
private void ProcessLoginAttemptButton_Click(object sender, RoutedEventArgs e) { // User input values string username = UsernameTextBox.Text; string password = PasswordTextbox.Text; List <User> allUsers = DatabaseHandler.getInstance().getAllUsers(); // Validate login attempt foreach (User user in allUsers) { if (user.username == username && user.password == password) { MainWindow2 loggedInWindow = new MainWindow2(user); loggedInWindow.Show(); this.Close(); return; } } }