/// <summary> /// Checks if the current user has a specific privilege and if it doesn't, it shows UI /// </summary> /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <param name="friendlyMessage">Text to display in addition to the stock text about the privilege</param> /// <returns> /// An interface for tracking the progress of the asynchronous call. /// The operation completes when the UI is closed. /// A boolean which is true if the current user has the privilege. /// </returns> public static Task <bool> CheckGamingPrivilegeWithUI(XboxLiveUser user, GamingPrivilege privilege, string friendlyMessage) { var tcs = new TaskCompletionSource <bool>(); Task.Run(() => { var pFriendlyMessage = MarshalingHelpers.StringToHGlobalUtf8(friendlyMessage); int contextKey; var context = XsapiCallbackContext <object, bool> .CreateContext(null, tcs, out contextKey); context.PointersToFree = new List <IntPtr> { pFriendlyMessage }; var result = TCUICheckGamingPrivilegeWithUI(privilege, pFriendlyMessage, CheckGamingPrivilegeComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId); if (result != XSAPI_RESULT.XSAPI_RESULT_OK) { tcs.SetException(new XboxException(result)); } }); return(tcs.Task); }
/// <summary> /// Checks if the current user has a specific privilege /// </summary> /// /// /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <returns> /// A boolean which is true if the current user has the privilege. /// </returns> public static bool CheckPrivilegeSilently(XboxLiveUser user, GamingPrivilege privilege) { string scope; string policy; GetPrivilegeScopePolicy(out scope, out policy); return(Microsoft.Xbox.Services.WinRT.TitleCallableUI.CheckPrivilegeSilently( (Microsoft.Xbox.Services.WinRT.GamingPrivilege)privilege, user.SystemUser, scope, policy )); }
/// <summary> /// Checks if the current user has a specific privilege and if it doesn't, it shows UI /// </summary> /// /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <param name="friendlyMessage">Text to display in addition to the stock text about the privilege</param> /// <returns> /// An interface for tracking the progress of the asynchronous call. /// The operation completes when the UI is closed. /// A boolean which is true if the current user has the privilege. /// </returns> public static Task <bool> CheckPrivilegeWithUIAsync(XboxLiveUser user, GamingPrivilege privilege, string friendlyMessage) { string scope; string policy; GetPrivilegeScopePolicy(out scope, out policy); return(Microsoft.Xbox.Services.WinRT.TitleCallableUI.CheckPrivilegeWithUIAsync( (Microsoft.Xbox.Services.WinRT.GamingPrivilege)privilege, friendlyMessage, user.SystemUser, scope, policy ).AsTask()); }
/// <summary> /// Checks if the current user has a specific privilege /// </summary> /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <returns> /// A boolean which is true if the current user has the privilege. /// </returns> public static bool CheckGamingPrivilegeSilently(XboxLiveUser user, GamingPrivilege privilege) { var tcs = new TaskCompletionSource <bool>(); Task.Run(() => { int contextKey = XsapiCallbackContext <object, bool> .CreateContext(null, tcs); var result = TCUICheckGamingPrivilegeSilently(privilege, CheckGamingPrivilegeComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId); if (result != XSAPI_RESULT.XSAPI_RESULT_OK) { tcs.SetException(new XboxException(result)); } }); tcs.Task.Wait(); return(tcs.Task.Result); }
/// <summary> /// Checks if the current user has a specific privilege /// </summary> /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <returns> /// A boolean which is true if the current user has the privilege. /// </returns> public static bool CheckGamingPrivilegeSilently(XboxLiveUser user, GamingPrivilege privilege) { var tcs = new TaskCompletionSource <bool>(); Task.Run(() => { int contextKey = XboxLiveCallbackContext <TitleCallableUI, bool> .CreateContext(null, tcs); XboxLive.Instance.Invoke <XsapiResult, TCUICheckGamingPrivilegeSilently>( privilege, (CheckGamingPrivilegeCompletionRoutine)CheckGamingPrivilegeSilentlyComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId ); }); tcs.Task.Wait(); return(tcs.Task.Result); }
/// <summary> /// Checks if the current user has a specific privilege and if it doesn't, it shows UI /// </summary> /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <param name="friendlyMessage">Text to display in addition to the stock text about the privilege</param> /// <returns> /// An interface for tracking the progress of the asynchronous call. /// The operation completes when the UI is closed. /// A boolean which is true if the current user has the privilege. /// </returns> public static Task <bool> CheckGamingPrivilegeWithUI(XboxLiveUser user, GamingPrivilege privilege, string friendlyMessage) { var tcs = new TaskCompletionSource <bool>(); Task.Run(() => { var pFriendlyMessage = MarshalingHelpers.StringToHGlobalUtf8(friendlyMessage); int contextKey = XboxLiveCallbackContext <TitleCallableUI, bool> .CreateContext(null, tcs, null, new List <IntPtr> { pFriendlyMessage }); XboxLive.Instance.Invoke <XsapiResult, TCUICheckGamingPrivilegeWithUI>( privilege, pFriendlyMessage, (CheckGamingPrivilegeCompletionRoutine)CheckGamingPrivilegeWithUIComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId ); }); return(tcs.Task); }
private static extern XSAPI_RESULT TCUICheckGamingPrivilegeWithUI( GamingPrivilege privilege, IntPtr friendlyMessage, XSAPI_CHECK_GAMING_PRIVILEGE_COMPLETION_ROUTINE completionRoutine, IntPtr completionRoutineContext, Int64 taskGroupId);
/// <summary> /// Checks if the current user has a specific privilege and if it doesn't, it shows UI /// </summary> /// /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <param name="friendlyMessage">Text to display in addition to the stock text about the privilege</param> /// <returns> /// An interface for tracking the progress of the asynchronous call. /// The operation completes when the UI is closed. /// A boolean which is true if the current user has the privilege. /// </returns> public static Task <bool> CheckPrivilegeWithUIAsync(XboxLiveUser user, GamingPrivilege privilege, string friendlyMessage) { return(Task.FromResult(true)); }
/// <summary> /// Checks if the current user has a specific privilege /// </summary> /// /// /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param> /// <param name="privilege">The privilege to check.</param> /// <returns> /// A boolean which is true if the current user has the privilege. /// </returns> public static bool CheckPrivilegeSilently(XboxLiveUser user, GamingPrivilege privilege) { return(true); }
private static extern XSAPI_RESULT TCUICheckGamingPrivilegeSilently( GamingPrivilege privilege, XSAPI_TCUI_CHECK_GAMING_PRIVILEGE_RESULT completionRoutine, IntPtr completionRoutineContext, Int64 taskGroupId);
public static Task <bool> CheckGamingPrivilegeWithUIForUser(GamingPrivilege privilege, string friendlyMessage, XboxLiveUser user) { throw new NotImplementedException(); }
public static bool CheckGamingPrivilegeSilentlyForUser(GamingPrivilege privilege, XboxLiveUser user) { throw new NotImplementedException(); }
public static Task <bool> CheckGamingPrivilegeWithUI(GamingPrivilege privilege, string friendlyMessage) { throw new NotImplementedException(); }
public static bool CheckGamingPrivilegeSilently(GamingPrivilege privilege) { throw new NotImplementedException(); }