private static void GetAuthenticationTokenFinished(GetAuthenticationTokenResponse result) { AuthenticationInformation authenticationInformation = (AuthenticationInformation)result.UserState; if(!string.IsNullOrEmpty(result.AuthenticationToken) && result.Status == GetAuthenticationTokenStatus.Successful) { authenticationInformation.Token = result.AuthenticationToken; authenticationInformation.User = result.AuthenticatedUser; authenticationInformation.Status = AuthenticationStatus.GetAuthenticationTokenFinishedSuccessfully; } else { authenticationInformation.Status = AuthenticationStatus.GetAuthenticationTokenFailed; } authenticationInformation.CurrentOperationCompleted(authenticationInformation); }
private void GetAuthenticationTokenCompleted(GetAuthenticationTokenResponse response) { if (response.Status == GetAuthenticationTokenStatus.Successful) { //Action<User> printUserInfoCallback = (Action<User>)response.UserState; //printUserInfoCallback(response.AuthenticatedUser); if (LoginSuccessful != null) { _authenticationToken = response.AuthenticationToken; LoginSuccessful(response.AuthenticatedUser); } } else { if (LoginFailed != null) { LoginFailed(); } } }
private void GetAuthenticationTokenCompleted(GetAuthenticationTokenResponse response) { Action<User> printUserInfoCallback = (Action<User>)response.UserState; printUserInfoCallback(response.AuthenticatedUser); }
private void GetAuthenticationTokenFinished(object sender, get_auth_tokenCompletedEventArgs e) { object[] state = (object[]) e.UserState; Exception error = null; OperationFinished<GetAuthenticationTokenResponse> getAuthenticationTokenCompleted = (OperationFinished<GetAuthenticationTokenResponse>) state[0]; GetAuthenticationTokenStatus status; if (e.Error == null) { status = StatusMessageParser.ParseGetAuthenticationTokenStatus(e.Result); if (status == GetAuthenticationTokenStatus.Unknown) { error = new UnknownOperationStatusException(e.Result); } } else { status = GetAuthenticationTokenStatus.Failed; error = e.Error; } GetAuthenticationTokenResponse response = new GetAuthenticationTokenResponse { Status = status, UserState = state[1], Error = error, AuthenticationToken = string.Empty }; if (response.Status == GetAuthenticationTokenStatus.Successful) { User authenticatedUser = new User(e.user); response.AuthenticatedUser = authenticatedUser; response.AuthenticationToken = e.auth_token; _token = e.auth_token; } getAuthenticationTokenCompleted(response); }