コード例 #1
0
ファイル: TwitterList.cs プロジェクト: Ruhowl/Twitterizer
        /// <summary>
        /// Updates the specified list.
        /// </summary>
        /// <param name="tokens">The oauth tokens.</param>
        /// <param name="listId">The list id.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterList"/> instance.</returns>
        /// <remarks></remarks>
        public static TwitterResponse<TwitterList> Update(OAuthTokens tokens, string listId, UpdateListOptions options)
        {
            Commands.UpdateListCommand command = new Twitterizer.Commands.UpdateListCommand(tokens, listId, options);

            return Core.CommandPerformer.PerformAction(command);
        }
コード例 #2
0
ファイル: TwitterList.cs プロジェクト: Ruhowl/Twitterizer
 public static TwitterResponse<TwitterList> Update(OAuthTokens tokens, string username, string listId, UpdateListOptions options)
 {
     return Update(tokens, listId, options);
 }
コード例 #3
0
        /// <summary>
        /// Updates the specified list.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="username">The username.</param>
        /// <param name="listId">The list id.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult Update(
            OAuthTokens tokens, 
            string username, 
            string listId, 
            UpdateListOptions options, 
            TimeSpan timeout,
            Action<TwitterAsyncResponse<TwitterList>> function)
        {
            Func<OAuthTokens, string, string, UpdateListOptions, TwitterResponse<TwitterList>> methodToCall = TwitterList.Update;

            return methodToCall.BeginInvoke(
                tokens,
                username,
                listId,
                options,
                result =>
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterList>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
コード例 #4
0
ファイル: Lists.cs プロジェクト: DigitallyBorn/Twitterizer3
 /// <summary>
 /// Updates the specified list.
 /// </summary>
 /// <param name="tokens">The oauth tokens.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="options">The options.</param>
 /// <returns>A <see cref="TwitterList"/> instance.</returns>
 /// <remarks></remarks>
 public static async Task<TwitterResponse<TwitterList>> UpdateAsync(OAuthTokens tokens, string listId, UpdateListOptions options)
 {
     return await Core.CommandPerformer.PerformAction(new Twitterizer.Commands.UpdateListCommand(tokens, listId, options));
 }
コード例 #5
0
 private async void Save()
 {
     if (this.IsValid)
     {
         string responseResultMessage;
         this.ProgressText = "Saving list...";
         this.ShowForm = false;
         this.ShowAnimation = true;
         UserAccountViewModel account = App.AppState.Accounts[this.TwitterAccountID];
         if (this.existingList == null)
         {
             TwitterResponse<TwitterList> response = await Lists.NewAsync(account.Tokens, this.Name, this.IsPublic, this.Description, MetroTwitTwitterizer.Options);
             TwitterResponse<TwitterList> newListResponse = response;
             if (newListResponse.Result == RequestResult.Success)
             {
                 this.OK();
             }
             else
             {
                 responseResultMessage = CommonCommands.GetResponseResultMessage(newListResponse.Result);
                 this.ShowAnimation = false;
                 this.ShowErrorMessage = true;
                 this.ErrorMessage = responseResultMessage;
             }
         }
         else
         {
             this.totalCountOfUsers = (from u in this.UsersInThisList
                                       where !u.IsSelected && u.AlreadyExistsInList
                                       select u).Count<MetroTwitUser>();
             UpdateListOptions options = new UpdateListOptions
             {
                 Name = this.Name,
                 Description = this.Description,
                 IsPublic = new bool?(this.IsPublic),
                 UseSSL = true
             };
             TwitterResponse < TwitterList > updateListResponse = await Lists.UpdateAsync(account.Tokens, this.existingList.Id.ToString(), options);
             if (updateListResponse.Result == RequestResult.Success)
             {
                 foreach (MetroTwitUser user in this.UsersInThisList)
                 {
                     if (!user.IsSelected && user.AlreadyExistsInList)
                     {
                         TwitterResponse<TwitterList> asyncVariable0 = await Lists.RemoveMemberAsync(account.Tokens, this.existingList.Id, user.BaseUser.Id, MetroTwitTwitterizer.Options);
                         
                         lock (this.countLock)
                         {
                             this.currentCount++;
                             if (asyncVariable0.Result == RequestResult.Success)
                             {
                                 this.existingList.NumberOfMembers--;
                             }
                             if (this.totalCountOfUsers == this.currentCount)
                             {
                                 this.OK();
                             }
                         }
                     }
                 }
             }
             else
             {
                 responseResultMessage = CommonCommands.GetResponseResultMessage(updateListResponse.Result);
                 this.ShowAnimation = false;
                 this.ShowErrorMessage = true;
                 this.ErrorMessage = responseResultMessage;
             }
         }
     }
 }
コード例 #6
0
 /// <summary>
 /// Updates the specified list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult Update(
     OAuthTokens tokens, 
     string listId, 
     UpdateListOptions options, 
     TimeSpan timeout,
     Action<TwitterAsyncResponse<TwitterList>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, listId, options, timeout, TwitterList.Update, function);
 }