private void onLogin(object sender, RoutedEventArgs e) { AdminUser user = UserQuery.login(emailField.Text, passwordField.Password); if (user != null) { Console.WriteLine("Hello " + user.getFirstname() + " " + user.getLastname()); Main main = new Main(user); main.Show(); Close(); } else { emailField.Text = ""; passwordField.Password = ""; Console.WriteLine("Wrong username or password."); } }