/// <summary> /// Add an identity value for this user. /// </summary> /// <param name="value">The value to add.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> AddAsync(this Buddy.Identity identity, string value) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); identity.AddInternal(value, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Add a new score for this user. /// </summary> /// <param name="score">The numeric value of the score.</param> /// <param name="board">The optional name of the game board.</param> /// <param name="rank">The optional rank for this score. This can be used for adding badges, achievements, etc.</param> /// <param name="latitude">The optional latitude for this score.</param> /// <param name="longitude">The optional longitude for this score.</param> /// <param name="oneScorePerPlayer">The optional one-score-per-player paramter. Setting this to true will always update the score for this user, instead of creating a new one.</param> /// <param name="appTag">An optional application tag for this score.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> AddAsync(this Buddy.GameScores gameScores, double score, string board = null, string rank = null, double latitude = 0, double longitude = 0, bool oneScorePerPlayer = false, string appTag = null) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); gameScores.AddInternal(score, board, rank, latitude, longitude, oneScorePerPlayer, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Adds a key/value pair to the User GameState. /// </summary> /// <param name="gameStateKey">The game state key.</param> /// <param name="gameStateValue">The value to persist.</param> /// <param name="appTag">An optional application tag for this score.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> AddAsync(this Buddy.GameStates gameStates, string gameStateKey, string gameStateValue, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); gameStates.AddInternal(gameStateKey, gameStateValue, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Add a friend request to a user. /// </summary> /// <param name="user">The user to send the request to, can't be null.</param> /// <param name="appTag">Mark this request with an tag, can be used on the user's side to make a decision on whether to accept the request.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> AddAsync(this Buddy.FriendRequests friendRequests, Buddy.User user, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); friendRequests.AddInternal(user, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }