private void getInitialTweets() { // this method mainly exists as the entry point for initially setting newestID and oldestID ListTweetsOnHomeTimelineOptions options = new ListTweetsOnHomeTimelineOptions(); IEnumerable<TwitterStatus> tweets = service.ListTweetsOnHomeTimeline(options); if (tweets == null) { printTwitterError(); } else { gotInitialTweets = true; newestID = tweets.First().Id; oldestID = tweets.Last().Id; foreach (var tweet in tweets) { incomingTweetsTextBox.Text += buildTweetString(tweet); } appStatusLabel.Text = "OK"; } }
public JsonResult GetHomeTweetsSince(string userName, string Nick, long id) { var twitterSecret = new Social_media_access.Models.TwitterSecretData(userName, Nick); var service = new TweetSharp.TwitterService(twitterSecret._OAuthConsumerKey, twitterSecret._OAuthConsumerSecret); service.AuthenticateWith(twitterSecret._OAuthAccessToken, twitterSecret._OAuthAccessTokenSecret); var _ListTweetsOnHomeTimelineOptions = new TweetSharp.ListTweetsOnHomeTimelineOptions(); _ListTweetsOnHomeTimelineOptions.Count = 11; _ListTweetsOnHomeTimelineOptions.SinceId = id; var tweets = service.ListTweetsOnHomeTimeline(_ListTweetsOnHomeTimelineOptions); return(Json(tweets, JsonRequestBehavior.AllowGet)); }
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); }
public virtual void ListTweetsOnHomeTimeline(ListTweetsOnHomeTimelineOptions options, Action<IEnumerable<TwitterStatus>, TwitterResponse> action) { var count = options.Count; var since_id = options.SinceId; var max_id = options.MaxId; var trim_user = options.TrimUser; var exclude_replies = options.ExcludeReplies; var contributor_details = options.ContributorDetails; var include_entities = options.IncludeEntities; WithHammock(action, "statuses/home_timeline", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&exclude_replies=", exclude_replies, "&contributor_details=", contributor_details, "&include_entities=", include_entities); }
public virtual IAsyncResult BeginListTweetsOnHomeTimeline(ListTweetsOnHomeTimelineOptions options) { var count = options.Count; var since_id = options.SinceId; var max_id = options.MaxId; var trim_user = options.TrimUser; var exclude_replies = options.ExcludeReplies; var contributor_details = options.ContributorDetails; var include_entities = options.IncludeEntities; return BeginWithHammock<IEnumerable<TwitterStatus>>(WebMethod.Get, "statuses/home_timeline", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&exclude_replies=", exclude_replies, "&contributor_details=", contributor_details, "&include_entities=", include_entities); }
public virtual Task<TwitterResponse<IEnumerable<TwitterStatus>>> ListTweetsOnHomeTimelineAsync(ListTweetsOnHomeTimelineOptions options) { var count = options.Count; var since_id = options.SinceId; var max_id = options.MaxId; var trim_user = options.TrimUser; var exclude_replies = options.ExcludeReplies; var contributor_details = options.ContributorDetails; var include_entities = options.IncludeEntities; return ExecuteRequest<IEnumerable<TwitterStatus>>("statuses/home_timeline", FormatAsString, "?count=", count, "&since_id=", since_id, "&max_id=", max_id, "&trim_user="******"&exclude_replies=", exclude_replies, "&contributor_details=", contributor_details, "&include_entities=", include_entities); }
public void listTimeLineTweets() { listView1.Items.Clear(); if (!_alreadyRegister) { // Step 3 - Exchange the Request Token for an Access Token string verifier = textBox1.Text; // <-- This is input into your application by your user var access = _twitterService.GetAccessToken(_requestToken, verifier); // Step 4 - User authenticates using the Access Token _twitterService.AuthenticateWith(access.Token, access.TokenSecret); _alreadyRegister = true; } var options = new ListTweetsOnHomeTimelineOptions(); options.Count = 200; // Step 5 - get Tweets var tweets = _twitterService.ListTweetsOnHomeTimeline(options); if (tweets == null) return; foreach (var tweet in tweets) { if(tweet.Text.ToLower().Contains(textBox2.Text.ToLower())) { var values = new[] { tweet.User.ScreenName, tweet.Text, tweet.RetweetCount.ToString(), tweet.IsFavorited.ToString() }; var lvItem = new ListViewItem(values); listView1.Items.Insert(listView1.Items.Count, lvItem); } //Console.WriteLine("{0} says '{1}'", tweet.User.ScreenName, tweet.Text); } //IEnumerable<TwitterStatus> mentions = service.ListTweetsMentioningMe(); }
private void twitterToolStripMenuItem_Click_1(object sender, EventArgs e) { TwitterClientInfo twitterClientInfo = new TwitterClientInfo(); twitterClientInfo.ConsumerKey = consumerKey; //Read ConsumerKey out of the app.config twitterClientInfo.ConsumerSecret = consumerSecret; //Read the ConsumerSecret out the app.config TwitterService twitterService = new TwitterService(consumerKey, consumerSecret); requestToken = twitterService.GetRequestToken(); if (AdvancedSoftwareProject.Properties.Settings.Default.AccessToken != "" && AdvancedSoftwareProject.Properties.Settings.Default.AccessTokenSecret != "") { try { twitterService.AuthenticateWith(AdvancedSoftwareProject.Properties.Settings.Default.AccessToken, AdvancedSoftwareProject.Properties.Settings.Default.AccessTokenSecret); } catch (Exception ex) { MessageBox.Show(ex.Message); authTwitter(twitterService); } } else { authTwitter(twitterService); } var options = new ListTweetsOnHomeTimelineOptions(); var currentTweets = twitterService.ListTweetsOnHomeTimeline(options); List<TwitterStatus> tweets = currentTweets.ToList(); //tweets[i].User.ScreenName //See https://github.com/danielcrenna/tweetsharp for more info on how to use tweets etc twitterFeed.DocumentText = ""; string twitterHTML = "<div style = \"color:0099FF\">"; for (int i = 0; i < tweets.Count; i++) { if (i != tweets.Count - 1) { twitterHTML = twitterHTML + tweets[i].TextAsHtml + "<br><br>"; } else { twitterHTML = twitterHTML + tweets[i].TextAsHtml + "</div>"; } } twitterFeed.DocumentText = twitterHTML; }
/// <summary> /// Returns the tweets for ChildCancerNZ /// </summary> /// <returns></returns> public IEnumerable<TwitterStatus> getTweets() { List<String> urlOfImages = new List<String>(); var service = new TwitterService(OAuthConsumerKey, OAuthConsumerSecret); service.AuthenticateWith(OAuthToken, OAuthTokenSecret); ListTweetsOnHomeTimelineOptions options = new ListTweetsOnHomeTimelineOptions(); IEnumerable<TwitterStatus> tweets = service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions {ScreenName = "ChildCancerNZ"}); return tweets; }
// methode om posts in de lijst posts te plaatsen van alle sociale netwerken public void syncPosts() { if ((this.chkbFacebook.Checked || this.chkBoxAll.Checked) && currentParent.loggedInUsers.ContainsKey(Post.SocialNetwork.Facebook)) { // sync Facebook: http://facebooksdk.net/docs/making-asynchronous-requests/ // parameters om mee te geven aan het request naar de FB API Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters["since"] = this.FBsince; parameters["limit"] = 25; // news feed ophalen if (!FBisSyncing) { this.FBisSyncing = true; currentParent.FBclient.GetTaskAsync("/me/home", parameters); currentParent.FBclient.GetCompleted += (o, e) => { if (e.Error == null) { dynamic result = e.GetResultData(); if (result.paging != null && result.data.Count != 0) { // nodig om bij te houden van wanneer we de laatste resultaten hebben opgehaald (Google: Facebook API pagination) string prevLink = result.paging.previous; string since = prevLink.Substring(prevLink.LastIndexOf("&since=") + 7, prevLink.IndexOf("&access_token=") - (prevLink.LastIndexOf("&since=") + 7)); this.FBsince = Convert.ToInt32(since); // de opgehaalde posts verwerken foreach (dynamic fbPost in result.data) { string strFromID = fbPost.from.id; long intFromID = Convert.ToInt64(strFromID); User user = new FacebookUser(intFromID.ToString(), fbPost.from.name, "http://graph.facebook.com/" + strFromID + "/picture?width=100&height=100"); string bericht = fbPost.message; string link = fbPost.link; string id = fbPost.id; string pictureUrl = fbPost.picture; DateTime tijdstip = Post.parseFBTime((string)fbPost.created_time); Post postToAdd; if (fbPost.type == "photo") { postToAdd = new FotoPost(id, user, bericht + " " + link, tijdstip, Post.SocialNetwork.Facebook, pictureUrl); } else { postToAdd = new Post(id, user, bericht + " " + link, tijdstip, Post.SocialNetwork.Facebook); } this.addPost(postToAdd); } } } this.FBisSyncing = false; }; } } if ((this.chkbInstagram.Checked || this.chkBoxAll.Checked) && currentParent.loggedInUsers.ContainsKey(Post.SocialNetwork.Instagram)) { // sync Instagram } if ((this.chkbTumblr.Checked || this.chkBoxAll.Checked) && currentParent.loggedInUsers.ContainsKey(Post.SocialNetwork.Tumblr)) { // sync Tumblr } if ((this.chkbTwitter.Checked || this.chkBoxAll.Checked) && currentParent.loggedInUsers.ContainsKey(Post.SocialNetwork.Twitter)) { if (!TWisSyncing) { TWisSyncing = true; ListTweetsOnHomeTimelineOptions options = new ListTweetsOnHomeTimelineOptions(); if (TWsince != -1) options.SinceId = TWsince; else options.Count = 10; IAsyncResult result = currentParent.TWclient.ListTweetsOnHomeTimeline(options, (tweets, response) => { if (response.StatusCode == HttpStatusCode.OK) { foreach (TwitterStatus tweet in tweets) { if (tweet.Id > TWsince) TWsince = tweet.Id; User user = new TwitterUser(tweet.Author.ScreenName, tweet.Author.ScreenName, tweet.Author.ProfileImageUrl); string bericht = tweet.Text; string id = tweet.IdStr; string link = tweet.Source; DateTime tijdstip = Post.parseTWTime(tweet.CreatedDate.ToString()); Post postToAdd = new Post(id, user, bericht, tijdstip, Post.SocialNetwork.Twitter); foreach (TwitterMedia media in tweet.Entities.Media) { if (media.MediaType == TwitterMediaType.Photo) { postToAdd = new FotoPost(id, user, bericht, tijdstip, Post.SocialNetwork.Twitter, media.MediaUrl); } } this.addPost(postToAdd); } } this.TWisSyncing = false; }); } } this.showPosts(); }
public List<TwitterStatusLight> ListHomeTimeline(Int64 LastID) { ListTweetsOnHomeTimelineOptions option = new ListTweetsOnHomeTimelineOptions(); option.SinceId = LastID; IEnumerable<TwitterStatus> response = _TwitterService.ListTweetsOnHomeTimeline(option); List<TwitterStatusLight> convertResponse = new List<TwitterStatusLight>(); foreach(TwitterStatus row in response) { TwitterStatusLight res = ConvertResult(row); convertResponse.Add(res); } return convertResponse; }
/// <summary> /// Updates the list of tweets one has /// </summary> public void GetTweets() { CleanTweets(); ListTweetsOnHomeTimelineOptions updateOpts = new ListTweetsOnHomeTimelineOptions(); updateOpts.Count = 25; var numUpdates = User.Account.ListTweetsOnHomeTimeline(updateOpts); List<TwitterStatus> unformattedTweets = new List<TwitterStatus>(); try { unformattedTweets = numUpdates.ToList(); } catch (ArgumentNullException) { TwitterResponse resp = User.Account.Response; if (resp.RateLimitStatus.RemainingHits == 0) { ScreenDraw.ShowMessage("You have hit the API Limit. Please try again in a few minutes"); } else if (resp.RateLimitStatus.RemainingHits < 0) { /* This shouldn't happen ever anymore, but keeping it here JUUUST in case */ ScreenDraw.ShowMessage("An error occured when retrieving tweets from Twitter. Please restart ClutterFeed"); System.Threading.Thread.Sleep(1000); ScreenDraw.Tweets.Dispose(); ScreenDraw.HeadLine.Dispose(); Curses.EndWin(); Environment.Exit(1); } return; } localTweetList = new List<InteractiveTweet>(); /* Resets the full list */ for (int index = 0; index < unformattedTweets.Count; index++) { InteractiveTweet formattedTweet = new InteractiveTweet(); formattedTweet = ConvertTweet(unformattedTweets[index]); localTweetList.Add(formattedTweet); } }
public static List<ModelTwitterFeedsDetails> GetTwitterTweets(string ScreenName) { ModelTwitterFeeds modelTwitterFeeds = new ModelTwitterFeeds(); List<ModelTwitterFeedsDetails> lstModelTwitterFeedsDetail = new List<ModelTwitterFeedsDetails>(); try { /*>>> API Creadentials <<<<//// >> Under Informnation is creating from Personal Account Information API >> For any change in this credentials Login Account : [email protected] >> API Name : News Get Application >> Please don't change any word without permission from following API Admin*/ string _consumerKey = "cvRCCaqLUlM9SyolFwYEQQ2uZ"; string _consumerSecret = "sVvOgCPwuzXo37v4qjAriGbftwEefMC9xNadPQLTsoOkeqiJ8C"; string _accessToken = "65042389-YQ3jLfP1RWu9Q7So9VAj3Rc3J9oMB0Suuv0jlioAN"; string _accessTokenSecret = "yHMVHihkHAaCIOJi2M9WEOq4fpODY1a0hdS92J9OZEJEL"; // API access Data End var service = new TwitterService(_consumerKey, _consumerSecret); //var tweets = new ListTweetsOnHomeTimelineOptions(); service.AuthenticateWith(_accessToken, _accessTokenSecret); IAsyncResult result = service.BeginListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions()); IEnumerable<TwitterStatus> tweets = service.EndListTweetsOnHomeTimeline(result); foreach (var tweet in tweets) { if (tweets != null) { modelTwitterFeeds.FeedId = 0; modelTwitterFeeds.UserPageId = 0; modelTwitterFeeds.UserPageTitle = String.Empty; modelTwitterFeeds.UserScreenName = String.Empty; modelTwitterFeeds.UserPageLanguage = String.Empty; modelTwitterFeeds.UserPageFollowers = 0; modelTwitterFeeds.UserPageCoverImageURL = String.Empty; modelTwitterFeeds.UserPageLogoImage = String.Empty; } var st1 = tweet.Text; //string var st2 = tweet.Source; //string var st3 = tweet.TextAsHtml; //string var st4 = tweet.TextDecoded; //string var st5 = tweet.RetweetedStatus; //TwitterStatus var st6 = tweet.RetweetCount; //int var st7 = tweet.RawSource; //string var st8 = tweet.Place; //TwitterPlace var st9 = tweet.Location; //TwitterGeoLocation var st10 = tweet.Language; //string var st11 = tweet.IsTruncated; //bool var st12 = tweet.IsRetweeted; //bool var st13 = tweet.IsPossiblySensitive; //bool is nullable var st14 = tweet.IsFavorited; //bool var st15 = tweet.InReplyToUserId; //long is nullable var st16 = tweet.InReplyToStatusId; //long is nullable var st17 = tweet.InReplyToScreenName; //string var st18 = tweet.IdStr; //string var st19 = tweet.Id; //long var st20 = tweet.FavoriteCount; //int var st21 = tweet.ExtendedEntities; //TwitterExtendedEntities var st22 = tweet.Entities; //TwitterEntities var st23 = tweet.CreatedDate; //DateTime var st24 = tweet.Author; //ITweeter } //TwitterAccount user = new TwitterAccount. //TwitterUser twitterUser = //>>GET OTHER USER TIMELINE//BeginListTweetsOnHomeTimeline TwitterService t_service = new TwitterService(_consumerKey, _consumerSecret); t_service.AuthenticateWith(_accessToken, _accessTokenSecret); var t_options = new ListTweetsOnHomeTimelineOptions(); t_options.ExcludeReplies = true; var t_tweets = t_service.ListTweetsOnHomeTimeline(t_options); //ListTweetsOnSpecifiedUserTimeline string ScreenNameBBCArabic = "BBCArabic"; string ScreenNameCNNArabic = "cnnarabic"; string ScreenName1 = "garbo_speaks"; var User_OptionInit = new ListTweetsOnUserTimelineOptions { ScreenName = ScreenNameCNNArabic, Count = 200, ExcludeReplies = true }; var User_Tweets = service.ListTweetsOnUserTimeline(User_OptionInit); string TweetText = String.Empty; foreach (var tweet in User_Tweets) { var userDetail = tweet.User; if (false) { var us1 = tweet.User.ContributorsEnabled; //bool? var us2 = tweet.User.CreatedDate; var us3 = tweet.User.Description; var us4 = tweet.User.FavouritesCount; var us5 = tweet.User.FollowersCount; var us6 = tweet.User.FollowRequestSent; var us7 = tweet.User.FriendsCount; var us8 = tweet.User.Id; var us9 = tweet.User.IsDefaultProfile; var us10 = tweet.User.IsGeoEnabled; var us11 = tweet.User.IsProfileBackgroundTiled; var us12 = tweet.User.IsProtected; var us13 = tweet.User.IsTranslator; var us14 = tweet.User.IsVerified; var us15 = tweet.User.Language; var us16 = tweet.User.ListedCount; var us17 = tweet.User.Location; var us18 = tweet.User.Name; var us19 = tweet.User.ProfileBackgroundColor; var us20 = tweet.User.ProfileBackgroundImageUrl; var us21 = tweet.User.ProfileBackgroundImageUrlHttps; var us22 = tweet.User.ProfileImageUrl; var us23 = tweet.User.ProfileImageUrlHttps; var us24 = tweet.User.ProfileLinkColor; var us25 = tweet.User.ProfileSidebarBorderColor; var us26 = tweet.User.ProfileSidebarFillColor; var us27 = tweet.User.ProfileTextColor; var us28 = tweet.User.RawSource; var us29 = tweet.User.ScreenName; var us30 = tweet.User.Status; var us31 = tweet.User.StatusesCount; var us32 = tweet.User.TimeZone; var us33 = tweet.User.Url; var us34 = tweet.User.UtcOffset; } var st1 = tweet.Text.ToSafeString(); //string TweetText = tweet.Text; var st2 = tweet.Source; //string var st3 = tweet.TextAsHtml; //string var st4 = tweet.TextDecoded; //string var st5 = tweet.RetweetedStatus; //TwitterStatus var st6 = tweet.RetweetCount; //int var st7 = tweet.RawSource; //string var st8 = tweet.Place; //TwitterPlace var st9 = tweet.Location; //TwitterGeoLocation var st10 = tweet.Language; //string var st11 = tweet.IsTruncated; //bool var st12 = tweet.IsRetweeted; //bool var st13 = tweet.IsPossiblySensitive; //bool is nullable var st14 = tweet.IsFavorited; //bool var st15 = tweet.InReplyToUserId; //long is nullable var st16 = tweet.InReplyToStatusId; //long is nullable var st17 = tweet.InReplyToScreenName; //string var st18 = tweet.IdStr; //string var st19 = tweet.Id; //long var st20 = tweet.FavoriteCount; //int var st21 = tweet.ExtendedEntities; //TwitterExtendedEntities var st22 = tweet.Entities; //TwitterEntities var twitterEntities = new TwitterEntities(); twitterEntities = st22; IList<TwitterUrl> twitterUrl = twitterEntities.Urls; //List<TwitterUrl> foreach (var url in twitterUrl) { var url1 = url.DisplayUrl; //string var url2 = url.EndIndex; //int var url3 = url.EntityType; //TwitterEntityType var entityType = url3; //4 Entity Types are Defined //TwitterEntityType.HashTag; //0 //TwitterEntityType.Mention; //1 //TwitterEntityType.Url; //2 //TwitterEntityType.Media; //3 var url4 = url.ExpandedValue; //string var url5 = url.Indices; //IList<int> var url6 = url.StartIndex; //int var url7 = url.Value; //string TweetText = TweetText.Trim().Replace(url.Value, String.Empty).Trim(); } IList<TwitterMention> twitterMention = twitterEntities.Mentions; //List<TwitterMention> foreach (var mention in twitterMention) { var url1 = mention.EndIndex; //int var url2 = mention.EntityType; //int var entityType = url2; //4 Entity Types are Defined //TwitterEntityType.HashTag; //0 //TwitterEntityType.Mention; //1 //TwitterEntityType.Url; //2 //TwitterEntityType.Media; //3 var url3 = mention.Id; //long var url4 = mention.Indices; //IList<int> var url5 = mention.Name; //string var url6 = mention.ScreenName; //string var url7 = mention.StartIndex; //int } IList<TwitterMedia> twitterMedia = twitterEntities.Media; //List<TwitterMedia> foreach (var media in twitterMedia) { var media1 = media.DisplayUrl; //string var media2 = media.EndIndex; //int var media3 = media.EntityType; //TwitterEntity var media4 = media.ExpandedUrl; //string var media5 = media.Id; //long var media6 = media.IdAsString; //string var media7 = media.Indices; //IList<int> var media8 = media.MediaType; //TwitterMediaType var twitterMediaType = media8; /*Three Types of MediaType TwitterMediaType.Photo; //0 TwitterMediaType.Video; //1 TwitterMediaType.AnimatedGif; //2 */ var media9 = media.MediaUrl; //string var media10 = media.MediaUrlHttps; //string //var FeedImageURLhttp = media.MediaUrl; for Http Image //var FeedImageURLhttps = media.MediaUrlHttps; for Https Image var media11 = media.Sizes; //TwitterMediaSizes var twitterMediaSizes = media11; //media11.Large //media11.Medium //media11.Small //media11.Thumb var media12 = media.StartIndex; //int var media13 = media.Url; //string TweetText = TweetText.Trim().Replace(media.Url, String.Empty).Trim(); } IList<TwitterHashTag> twitterHashTag = twitterEntities.HashTags; //List<TwitterHashTag> foreach (var hashTag in twitterHashTag) { var ht1 = hashTag.EndIndex; var ht2 = hashTag.EntityType; var ht3 = hashTag.Indices; var ht4 = hashTag.StartIndex; var ht5 = hashTag.Text; // hashTagText for refine Tweet Text TweetText = TweetText.Trim().Replace("#" + hashTag.Text, string.Empty).Trim(); } TweetText = TweetText.Replace("\n", String.Empty).Trim(); var st23 = tweet.CreatedDate; //DateTime var st24 = tweet.Author; //ITweeter var ProfileImageURL = st24.ProfileImageUrl; var ss = st24.RawSource; var screenName = st24.ScreenName; } return lstModelTwitterFeedsDetail; } catch (Exception ex) { throw ex; } }
private void getNewTweetsButton_Click(object sender, EventArgs e) { if (!loggedIn) { printNotLoggedInError(); } else { // if we never got initial tweets (prolly because rate limiting prevented it right after we logged in), get them now if (!gotInitialTweets) { getInitialTweets(); } // get new tweets ListTweetsOnHomeTimelineOptions options = new ListTweetsOnHomeTimelineOptions(); options.SinceId = newestID; IEnumerable<TwitterStatus> tweets = service.ListTweetsOnHomeTimeline(options); if (tweets == null) { // internal twitter error printTwitterError(); } else { if (tweets.Count() > 0) { // update newestID so the next call to this function only grabs even newer tweets newestID = tweets.First().Id; // build a string for all of the new tweets String newerTweets = ""; foreach (var tweet in tweets) { newerTweets += buildTweetString(tweet); } // prepend the new tweets string to the existing string of tweets incomingTweetsTextBox.Text = newerTweets + incomingTweetsTextBox.Text; } appStatusLabel.Text = "OK"; } } }
private void getOlderTweetsButton_Click(object sender, EventArgs e) { if (!loggedIn) { printNotLoggedInError(); } else { // If we never got initial tweets (prolly because rate limiting prevented it right after we logged in), get them now if (!gotInitialTweets) { getInitialTweets(); } // get older tweets ListTweetsOnHomeTimelineOptions options = new ListTweetsOnHomeTimelineOptions(); options.MaxId = oldestID - 1; IEnumerable<TwitterStatus> tweets = service.ListTweetsOnHomeTimeline(options); if (tweets == null) { // internal twitter error printTwitterError(); } else { if (tweets.Count() > 0) { // update oldestID so the next call to this function only grabs even older tweets oldestID = tweets.Last().Id; // append all of the older tweets to the existing string of tweets foreach (var tweet in tweets) { incomingTweetsTextBox.Text += buildTweetString(tweet); } } appStatusLabel.Text = "OK"; } } }