public void Login() { // Login logic var credentials = new UserCredentials { Username = Username, Password = UserPassword }; var resp = _unitRepository.AuthenticateUnit(credentials); if (resp == null) { return; } if (resp.IsValid) { IsLoginValid = true; LoggedInUnit = resp.Unit; TryClose(); } else { var dialog = new MessageBoxViewModel(DialogType.Warning, DialogButton.Ok, "Login Failed", "Login Error: " + resp.InvalidReason); _windowManager.ShowDialog(dialog); } }