/// <summary> /// Create a new message group. /// </summary> /// <param name="name">The name of the new group, must be unique for the app.</param> /// <param name="openGroup">Optionally whether to make to group open for all user (anyone can join), or closed (only the owner can add users to it).</param> /// <param name="appTag">An optional application tag for this message group.</param> /// <returns>A Task<MessageGroup>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<MessageGroup> CreateAsync(this Buddy.MessageGroups messageGroups, string name, bool openGroup, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<MessageGroup>(); messageGroups.CreateInternal(name, openGroup, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Create a new virtual album. Note that this method internally does two web-service calls, and the IAsyncResult object /// returned is only valid for the first one. /// </summary> /// <param name="name">The name of the new virtual album.</param> /// <param name="appTag">An optional application tag for the album.</param> /// <returns>A Task<VirtualAlbum>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<VirtualAlbum> CreateAsync(this Buddy.VirtualAlbums virtualAlbums, string name, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<VirtualAlbum>(); virtualAlbums.CreateInternal(name, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }