public void Register(object sender, RoutedEventArgs e) { if (IsValid()) { var userCreated = _userManager.RegisterUser(GetUser()); if (userCreated) { MessageBoxResult result = MessageBox.Show("User has been created. You will be navigated to the login window.", "Creation Result", MessageBoxButton.OK); if (result == MessageBoxResult.OK) { var loginWindow = new LoginWindow(); loginWindow.Show(); Close(); } } } }