private static void GetTokenAndSignatureComplete(XSAPI_RESULT_INFO result, XSAPI_TOKEN_AND_SIGNATURE_RESULT payload, IntPtr context) { int contextKey = context.ToInt32(); XsapiCallbackContext <UserImpl, GetTokenAndSignatureResult> contextObject; if (XsapiCallbackContext <UserImpl, GetTokenAndSignatureResult> .TryRemove(contextKey, out contextObject)) { if (result.errorCode == XSAPI_RESULT.XSAPI_RESULT_OK) { contextObject.TaskCompletionSource.SetResult(new GetTokenAndSignatureResult { WebAccountId = MarshalingHelpers.Utf8ToString(payload.WebAccountId), Privileges = MarshalingHelpers.Utf8ToString(payload.Privileges), AgeGroup = MarshalingHelpers.Utf8ToString(payload.AgeGroup), Gamertag = MarshalingHelpers.Utf8ToString(payload.Gamertag), XboxUserId = MarshalingHelpers.Utf8ToString(payload.XboxUserId), Signature = MarshalingHelpers.Utf8ToString(payload.Signature), Token = MarshalingHelpers.Utf8ToString(payload.Token) }); } else { contextObject.TaskCompletionSource.SetException(new XboxException(result)); } contextObject.Dispose(); } }
private static void CheckGamingPrivilegeComplete(XSAPI_RESULT_INFO result, bool hasPrivilege, IntPtr completionRoutineContext) { int contextKey = completionRoutineContext.ToInt32(); XsapiCallbackContext <TitleCallableUI, bool> context; if (XsapiCallbackContext <TitleCallableUI, bool> .TryRemove(contextKey, out context)) { context.TaskCompletionSource.SetResult(hasPrivilege); context.Dispose(); } }
private static void ShowProfileCardUIComplete(XSAPI_RESULT_INFO result, IntPtr completionRoutineContext) { int contextKey = completionRoutineContext.ToInt32(); XsapiCallbackContext <TitleCallableUI, bool> context; if (XsapiCallbackContext <TitleCallableUI, bool> .TryRemove(contextKey, out context)) { context.TaskCompletionSource.SetResult(true); context.Dispose(); } }
private static void SignInComplete(XSAPI_RESULT_INFO result, XSAPI_SIGN_IN_RESULT payload, IntPtr context) { int contextKey = context.ToInt32(); XsapiCallbackContext <UserImpl, SignInResult> contextObject; if (XsapiCallbackContext <UserImpl, SignInResult> .TryRemove(contextKey, out contextObject)) { UserImpl @this = contextObject.Context; if (result.errorCode == XSAPI_RESULT.XSAPI_RESULT_OK) { @this.UpdatePropertiesFromXboxLiveUserPtr(); @this.SignInCompleted(@this, new EventArgs()); contextObject.TaskCompletionSource.SetResult(new SignInResult(payload.status)); } else { contextObject.TaskCompletionSource.SetException(new XboxException(result)); } contextObject.Dispose(); } }