public static CommentViewModel ConvertCommentToCommon(Comment comment) { CommentViewModel model = new CommentViewModel(); model.Content = comment.text; model.Title = comment.user.name; model.IconURL = comment.user.profile_image_url; model.ID = comment.id; model.UID = comment.user.id; model.TimeObject = string.IsNullOrEmpty(comment.created_at) ? new DateTimeOffset() : ExtHelpers.GetSinaTimeFullObject(comment.created_at); model.Type = EntryType.SinaWeibo; return model; }
// 跳转到此页有2种情况 // 1:对状态本身的评论 此时m_itemViewModel有值 // 2:对评论本身的评论 此时m_itemViewModel和m_commentViewModel都需要有值 protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); try { Dictionary<String, Object> parameters = e.Parameter as Dictionary<String, Object>; if (parameters.ContainsKey("ItemViewModel")) { m_itemViewModel = parameters["ItemViewModel"] as ItemViewModel; m_type = m_itemViewModel.Type; } if (parameters.ContainsKey("CommentViewModel")) m_commentViewModel = parameters["CommentViewModel"] as CommentViewModel; } catch (System.Exception ex) { } ChangeUIByInputType(); }