public List <TwitterStatus> GetTweetsFromServiceAsync(string account) { if (account == null || string.IsNullOrEmpty(account)) { return(new List <TwitterStatus>()); } var accountOptions = new ListTweetsOnUserTimelineOptions { ScreenName = account, Count = TweetsCount }; IAsyncResult asyncresult = twitterService.BeginListTweetsOnUserTimeline(accountOptions); var result = twitterService.EndListTweetsOnHomeTimeline(asyncresult, TimeOut); if (!asyncresult.IsCompleted) { throw new TimeoutException(); } return(result == null ? new List <TwitterStatus>() : result.ToList()); }
static public List <TwitterItem> getTimeline(TwitterService service, AccountTwitter account, DoWorkEventArgs e, decimal minimumId) { IEnumerable <TwitterStatus> tweets; List <TwitterItem> allTweets = new List <TwitterItem>(); try { ListTweetsOnHomeTimelineOptions options = new TweetSharp.ListTweetsOnHomeTimelineOptions(); options.Count = Properties.Settings.Default.TwitterItemsFetchInPast; if (minimumId >= 0) { options.SinceId = Convert.ToInt64(minimumId); } IAsyncResult result = service.BeginListTweetsOnHomeTimeline(options); tweets = service.EndListTweetsOnHomeTimeline(result); foreach (TwitterStatus status in tweets) { if (e != null) { if (e.Cancel) { AppController.Current.Logger.writeToLogfile("Cancel received for timeline"); break; } } allTweets.Add(API.TweetSharpConverter.getItemFromStatus(status, account)); } } catch (Exception exp) { AppController.Current.sendNotification("ERROR", exp.Message, exp.StackTrace, "", null); } return(allTweets); }