예제 #1
0
        static public List <TwitterItem> getMentions(TwitterService service, AccountTwitter account, DoWorkEventArgs e, decimal minimumId)
        {
            IEnumerable <TwitterStatus> mentions;
            List <TwitterItem>          allTweets = new List <TwitterItem>();

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

                IAsyncResult result = service.BeginListTweetsMentioningMe(options);
                mentions = service.EndListTweetsMentioningMe(result);


                foreach (TwitterStatus status in mentions)
                {
                    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);
        }