using System; using System.Net; using JuickApi; using Juick.Classes; using System.Globalization; namespace Juick.ViewModels { public class PostItem { public PostItem(Message message) { MID = message.Mid; RID = message.Rid; Username = message.User.UName; // Juick timestamp in utc: 2013-04-22 13:14:30 var timestamp = DateTime.ParseExact(message.Timestamp, "yyyy-MM-dd HH:mm:ss", null); Status = string.Format("{0}", DateHelper.PrettyDate(timestamp.ToLocalTime())); if (message.Replies > 0) Status = string.Format("{0}, replies: {1}", Status, message.Replies); MessageText = HttpUtility.HtmlDecode(message.Body); UserfeedUri = new Uri(string.Format("/UserFeed.xaml?uid={0}", message.User.Uid), UriKind.Relative); if (message.Tags != null) { MessageText = string.Join(", ", message.Tags) + Environment.NewLine + MessageText; } AvatarUri = new Uri(string.Format("http://i.juick.com/as/{0}.png", message.User.Uid), UriKind.Absolute); if (message.Photo != null) { Attachment = new Uri(message.Photo.Small, UriKind.Absolute); } } public int MID {get;set;} public int RID {get;set;} public string Username {get;set;} public Uri AvatarUri {get;set;} public Uri UserfeedUri { get; set; } public Uri Attachment {get;set;} public string Status {get;set;} public string MessageText { get; set; } } }