private void LogIn_click(object sender, RoutedEventArgs e) { string userName = NameBox.Text.Trim(); State.User = DatabaseAPI.GetCustomerByName(userName); if (State.User != null) { var next_window = new MainWindow(); next_window.Show(); this.Close(); } else { NameBox.Text = "Fel namn, välj ett annat..."; } }