示例#1
0
        static public List <TwitterItem> getFavorites(TwitterService service, AccountTwitter account, DoWorkEventArgs e, decimal minimumId)
        {
            IEnumerable <TwitterStatus> favorites;
            List <TwitterItem>          allTweets = new List <TwitterItem>();

            try
            {
                ListFavoriteTweetsOptions options = new TweetSharp.ListFavoriteTweetsOptions();
                options.Count = Properties.Settings.Default.TwitterItemsFetchInPast;
                if (minimumId >= 0)
                {
                    options.SinceId = Convert.ToInt64(minimumId);
                }

                IAsyncResult result = service.BeginListFavoriteTweets(options);
                favorites = service.EndListTweetsMentioningMe(result);


                foreach (TwitterStatus status in favorites)
                {
                    if (e != null)
                    {
                        if (e.Cancel)
                        {
                            AppController.Current.Logger.writeToLogfile("Cancel received for Mentions");
                            break;
                        }
                    }
                    allTweets.Add(API.TweetSharpConverter.getItemFromStatus(status, account));
                    foreach (TwitterItem item in allTweets)
                    {
                        item.isMention = true;
                    }
                }
            }
            catch
            {
                // xxx
            }
            return(allTweets);
        }
		public virtual void ListFavoriteTweets(ListFavoriteTweetsOptions options, Action<IEnumerable<TwitterStatus>, TwitterResponse> action)
		{
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var include_entities = options.IncludeEntities;
			
			WithHammock(action, "favorites/list", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&count=", count, "&since_id=", since_id, "&max_id=", max_id, "&include_entities=", include_entities);
		}
		public virtual IAsyncResult BeginListFavoriteTweets(ListFavoriteTweetsOptions options)
		{
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var include_entities = options.IncludeEntities;
				

			return BeginWithHammock<IEnumerable<TwitterStatus>>(WebMethod.Get, "favorites/list", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&count=", count, "&since_id=", since_id, "&max_id=", max_id, "&include_entities=", include_entities);
		}
		public virtual Task<TwitterResponse<IEnumerable<TwitterStatus>>> ListFavoriteTweetsAsync(ListFavoriteTweetsOptions options)
		{
			var user_id = options.UserId;
			var screen_name = options.ScreenName;
			var count = options.Count;
			var since_id = options.SinceId;
			var max_id = options.MaxId;
			var include_entities = options.IncludeEntities;
				
			
			return ExecuteRequest<IEnumerable<TwitterStatus>>("favorites/list", FormatAsString, "?user_id=", user_id, "&screen_name=", screen_name, "&count=", count, "&since_id=", since_id, "&max_id=", max_id, "&include_entities=", include_entities);
		}