//public string ThumbnailXXX { get; set; } //public string FullImage { get; set;} public BreakingNews(Post parent){ Id = parent.Id; Title = parent.Title; IsBreakingNews = true; Title_plain = parent.Title_plain; //Thumbnail_images = parent.Thumbnail_images; // //FullImage = parent.IconSource; //ThumbnailXXX = FullImage; }
public void Init(Post post) { base.Init (post); Post = post; Comment_count = Post.Comment_count; Title = Post.FirstCategoryName; NewsTitle = Post.Title_plain; Like_count = 0; if (Post.Kento_vote != null) Like_count = Post.Kento_vote.Vote_up_total; Comments = new ObservableCollection<Comment> (); DoRefreshCommentsCommand (); }
public void Add(Post post, bool checkExist = false) { if (checkExist) { if (isExistPost(post.Id)) return; } ListPost.Add(post); //System.Diagnostics.Debug.WriteLine ("Added Post: " + post.Title); }
private void DoSelectCatalogNews(Post item) { ShowViewModel<PostViewModel>(item); }
public async Task LoadPost() { if (Status == NetworkStatus.NotReachable) {//true || ShowErrorMessage (Settings.MSG_NETWORK_NOT_REACHABLE); return; } IsLoading = true; RequestPost req = new RequestPost(); req.Id = Post.Id; ResponsePost detailPost; try{ detailPost = await Service.GetPost (req); Post = detailPost.Post; if (Post.Kento_vote != null) { IsLikedThisPost = Post.Kento_vote.Vote_status == 1; Like_count = Post.Kento_vote.Vote_up_total; } Title = Post.FirstCategoryName;//category name - home post } catch (Exception e){ Debug.WriteLine (e); ShowErrorMessage (Settings.MSG_NETWORK_COMMON, e); return; } var doc = new HtmlAgilityPack.HtmlDocument(); //remove ulike info try { doc.LoadHtml(detailPost.Post.Content); foreach(var item in doc.DocumentNode.ChildNodes) { if (item.Id.StartsWith ("kento-vote")) { item.InnerHtml = string.Empty; Debug.WriteLine ("Empty ULike Info: " + item.OuterHtml); } //remove follow & unfollow content if (item.Attributes["class"] != null && item.Attributes["class"].Value.StartsWith("wpw-fp-follow-post-wrapper")) item.InnerHtml = string.Empty; } var stringBuilder = new System.Text.StringBuilder(); doc.Save (new System.IO.StringWriter(stringBuilder)); Post.Content = stringBuilder.ToString(); } catch (Exception e) { ShowErrorMessage (Settings.MSG_NETWORK_COMMON, e); } //Repair comment content to plain text try { Comment_count = Post.Comment_count; foreach (Comment comment in Post.Comments) { doc.LoadHtml(comment.Content); foreach(var item in doc.DocumentNode.ChildNodes)// "//div" is a xpath which means select div nodes that are anywhere in the html { if (item.Id.StartsWith ("wp-ulike-comment-")) { item.InnerHtml = string.Empty; Debug.WriteLine (item.OuterHtml); } } comment.Content = System.Net.WebUtility.HtmlDecode (doc.DocumentNode.InnerText); Comments.Add (comment); } } catch (Exception e) { Debug.WriteLine ("[CommentPage-LoadComments] {0}", e); } string featured_img = Post.FullImage; //Post.IconSource==null ? "" : (Post.Thumbnail_images.Full.Url ?? Post.IconSource) ; string timeAgo = new TimeAgoValueConverter ().Convert (Post.Date, null, null, null).ToString(); // Html = NewsTemplates.DETAIL_TEMPLATE_HEADER + String.Format(NewsTemplates.DETAIL_TEMPLATE_BODY, Post.Title, timeAgo, featured_img ,Post.Content, Post.FirstCategoryName); Html = String.Format(NewsTemplates.DETAIL_TEMPLATE, Post.Title, timeAgo, featured_img ,Post.Content, Post.FirstCategoryName); //test video player //Html = string.Format(NewsTemplates.DETAIL_VIDEO_PLAYER, "http://techslides.com/demos/sample-videos/small.mp4"); RaisePropertyChanged ("Comment_count"); RaisePropertyChanged ("Comments"); IsLoading = false; }
public void Init(Post post){ Post = post; Comment_count = Post.Comment_count; Title = Post.FirstCategoryName; NewsTitle = Post.Title_plain; Like_count = 0; if (Post.Kento_vote != null) Like_count = Post.Kento_vote.Vote_up_total; Comments = new ObservableCollection<Comment> (); LoggedOut = !Settings.wpLoggedIn; }