public static Tweet CreateRetweet(MahApps.Twitter.Models.Tweet s, TwitterContact contact) { contact.UpdateContactWithTwitterUser(s.User, s.Created); var t = new Tweet { ID = s.Id.ToString(), Contact = contact, Text = WebUtility.HtmlDecode(s.Text), Time = s.Created.ToLocalTime(), SourceUri = s.Source.GetSourceURL(), Source = s.Source.GetSourceText(), Favourite = s.Favourited, }; if (s.Coordinates != null && s.Coordinates.Lat != null && s.Coordinates.Long != null) t.Location = new GeoLocation((double) s.Coordinates.Lat, (double) s.Coordinates.Long); if (s.InReplyToStatusId > 0) { t.InReplyToID = s.InReplyToStatusId.ToString(); t.InReplyTo = new Contact {Name = s.InReplyToScreenName}; } return t; }
public static Tweet CreateTweet(MahApps.Twitter.Models.Tweet s, TwitterContact contact, IMicroblog source) { if (s.RetweetedStatus != null) return CreateRetweet(s, contact); if (contact.ImageUrl != new Uri(s.User.ProfileImageUrl)) contact.SetContactImage(new Uri(s.User.ProfileImageUrl), s.Created); contact.Bio = s.User.Description; contact.Following = s.User.FriendsCount; contact.Followers = s.User.FollowersCount; contact.FullName = s.User.Name; var t = new Tweet { ID = s.Id.ToString(), Contact = contact, Text = WebUtility.HtmlDecode(s.Text), Time = s.Created.ToLocalTime(), SourceUri = s.Source.GetSourceURL(), Source = s.Source.GetSourceText(), Favourite = s.Favourited, Microblog = source, }; if (s.Coordinates != null && s.Coordinates.Lat != null && s.Coordinates.Long != null) t.Location = new GeoLocation((double) s.Coordinates.Lat, (double) s.Coordinates.Long); if (s.InReplyToStatusId > 0) { t.InReplyToID = s.InReplyToStatusId.ToString(); t.InReplyTo = new Contact {Name = s.InReplyToScreenName}; } t.AddParent(source); return t; }