void CheckForMessages(object o) { string icon = ""; TwitterStatus message; TwitterParameters parameters; try { // get the most recent update parameters = new TwitterParameters(); parameters.Add(TwitterParameterNames.Count, 1); message = blog.DirectMessages.DirectMessages(parameters) [0]; if (message.Created <= messages_last_updated) { return; } messages_last_updated = message.Created; icon = FindIconForUser(message.TwitterUser); OnMessageFound(message.TwitterUser.ScreenName, message.Text, icon); } catch (Exception e) { Log <MicroblogClient> .Debug(GenericErrorMsg, "CheckForMessages", e.Message); } }
void UpdateTimeline(object o) { string icon = ""; TwitterStatus tweet; TwitterParameters parameters; try { // get the most recent update parameters = new TwitterParameters(); parameters.Add(TwitterParameterNames.Count, 1); tweet = blog.Status.FriendsTimeline(parameters) [0]; if (tweet.TwitterUser.ScreenName.Equals(username) || tweet.Created <= timeline_last_updated) { return; } icon = FindIconForUser(tweet.TwitterUser); timeline_last_updated = tweet.Created; OnTimelineUpdated(tweet.TwitterUser.ScreenName, tweet.Text, icon); Contacts.Where(contact => contact.Id == tweet.TwitterUser.ID) .First() .AddStatus(new MicroblogStatus(tweet.ID, tweet.Text, tweet.TwitterUser.ScreenName, tweet.Created)); } catch (Exception e) { Log <MicroblogClient> .Debug(GenericErrorMsg, "UpdateTimeline", e.Message); } }