/// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Shows UI displaying the profile card for a specified user.
        /// </summary>
        /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param>
        /// <param name="targetXboxUserId">The Xbox User ID to show information about.</param>
        /// <returns>
        /// An interface for tracking the progress of the asynchronous call.
        /// The operation completes when the UI is closed.
        /// </returns>
        public static Task ShowProfileCardUIAsync(XboxLiveUser user, string targetXboxUserId)
        {
            var tcs = new TaskCompletionSource <bool>();

            Task.Run(() =>
            {
                var pTargetXboxUserId = MarshalingHelpers.StringToHGlobalUtf8(targetXboxUserId);
                int contextKey        = XboxLiveCallbackContext <TitleCallableUI, bool> .CreateContext(null, tcs, null, new List <IntPtr> {
                    pTargetXboxUserId
                });

                XboxLive.Instance.Invoke <XsapiResult, TCUIShowProfileCardUI>(
                    pTargetXboxUserId,
                    (ShowProfileCardUICompletionRoutine)ShowProfileCardUIComplete,
                    (IntPtr)contextKey,
                    XboxLive.DefaultTaskGroupId
                    );
            });

            return(tcs.Task);
        }
Exemplo n.º 6
0
        /// <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);
        }
        /// <summary>
        /// Shows UI displaying the profile card for a specified user.
        /// </summary>
        /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param>
        /// <param name="targetXboxUserId">The Xbox User ID to show information about.</param>
        /// <returns>
        /// An interface for tracking the progress of the asynchronous call.
        /// The operation completes when the UI is closed.
        /// </returns>
        public static Task ShowProfileCardUIAsync(XboxLiveUser user, string targetXboxUserId)
        {
            var tcs = new TaskCompletionSource <object>();

            Task.Run(() =>
            {
                var pTargetXboxUserId = MarshalingHelpers.StringToHGlobalUtf8(targetXboxUserId);

                int contextKey;
                var context            = XsapiCallbackContext <object, object> .CreateContext(null, tcs, out contextKey);
                context.PointersToFree = new List <IntPtr> {
                    pTargetXboxUserId
                };

                var result = TCUIShowProfileCardUI(pTargetXboxUserId, ShowProfileCardUIComplete, (IntPtr)contextKey, XboxLive.DefaultTaskGroupId);
                if (result != XSAPI_RESULT.XSAPI_RESULT_OK)
                {
                    tcs.SetException(new XboxException(result));
                }
            });

            return(tcs.Task);
        }
 public static Task ShowTitleAchievementsUIForUserAsync(uint titleId, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
 /// <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>
 /// Shows UI displaying the profile card for a specified user.
 /// </summary>
 /// <param name="user">XboxLiveUser that identifies the user to show the UI on behalf of.</param>
 /// <param name="targetXboxUserId">The Xbox User ID to show information about.</param>
 /// <returns>
 /// An interface for tracking the progress of the asynchronous call.
 /// The operation completes when the UI is closed.
 /// </returns>
 public static Task ShowProfileCardUIAsync(XboxLiveUser user, string targetXboxUserId)
 {
     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);
 }
 public static Task <bool> CheckGamingPrivilegeWithUIForUser(GamingPrivilege privilege, string friendlyMessage, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
        public UserImpl(EventHandler <SignInCompletedEventArgs> signInCompleted, EventHandler <SignOutCompletedEventArgs> signOutCompleted, User systemUser, XboxLiveUser xboxLiveuser)
        {
            if (systemUser == null && IsMultiUserApplication())
            {
                throw(new XboxException("Xbox Live User object is required to be constructed by a Windows.System.User object for a multi-user application."));
            }

            //Initiate user watcher
            if (IsMultiUserApplication())
            {
                if (userWatcher == null)
                {
                    userWatcher          = Windows.System.User.CreateWatcher();
                    userWatcher.Removed += UserWatcher_UserRemoved;
                }
            }

            this.signInCompleted   = signInCompleted;
            this.signOutCompleted  = signOutCompleted;
            this.CreationContext   = systemUser;
            this.UserWeakReference = new WeakReference(xboxLiveuser);

            var appConfig = XboxLiveAppConfiguration.Instance;

            this.AuthConfig = new AuthConfig
            {
                Sandbox           = appConfig.Sandbox,
                EnvrionmentPrefix = appConfig.EnvironmentPrefix,
                Envrionment       = appConfig.Environment,
                UseCompactTicket  = appConfig.UseFirstPartyToken
            };
        }
 public static bool CheckGamingPrivilegeSilentlyForUser(GamingPrivilege privilege, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
 public static Task <global::System.Collections.ObjectModel.ReadOnlyCollection <string> > ShowPlayerPickerUIForUser(string promptDisplayText, string[] xboxUserIds, string[] preselectedXboxUserIds, uint minSelectionCount, uint maxSelectionCount, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
 public static Task ShowChangeFriendRelationshipUIForUserAsync(string targetXboxUserId, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
 public static Task ShowProfileCardUIForUserAsync(string targetXboxUserId, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }
 public static Task ShowGameInviteUIForUserAsync(Microsoft.Xbox.Services.Multiplayer.MultiplayerSessionReference sessionReference, string contextStringId, XboxLiveUser user)
 {
     throw new NotImplementedException();
 }