/// <summary> /// コメントをGUIに登録する /// </summary> /// <param name="workCommentList"></param> private void SetCmntToGui(IList <CommentStruct> workCommentList) { // 登録済みの最新コメントを取得 for (int iComment = 0; iComment < workCommentList.Count; iComment++) { CommentStruct tagtComment = workCommentList[iComment]; // 新規のコメントの場合、リストに追加する CommentList.Add(tagtComment); System.Diagnostics.Debug.WriteLine("■{0} {1}", tagtComment.UserName, tagtComment.Text); // 最大コメント数チェック if (CommentList.Count > MaxStoredCommentCnt) { CommentList.RemoveAt(0); System.Diagnostics.Debug.Assert(CommentList.Count == MaxStoredCommentCnt); } if (OnCommentReceiveEach != null) { OnCommentReceiveEach(this, tagtComment); } } if (OnCommentReceiveDone != null) { OnCommentReceiveDone(this); } }
public Entry(XmlElement element) { Id = Util.ChildValue(element, "id"); Title = Util.ChildValue(element, "title"); Link = Util.ChildValue(element, "link"); Published = DateTime.Parse(Util.ChildValue(element, "published")); Updated = DateTime.Parse(Util.ChildValue(element, "updated")); User = new User(Util.ChildElement(element, "user")); Service = new Service(Util.ChildElement(element, "service")); Comments = new CommentList(); foreach (XmlElement child in element.GetElementsByTagName("comment")) { Comments.Add(new Comment(child)); } Likes = new LikeList(); foreach (XmlElement child in element.GetElementsByTagName("like")) { Likes.Add(new Like(child)); } Media = new MediaList(); foreach (XmlElement child in element.GetElementsByTagName("media")) { Media.Add(new Media(child)); } }
/// <summary> /// コメントをGUIに登録する /// </summary> /// <param name="workCommentList"></param> private void setCmntToGui(IList <CommentStruct> workCommentList) { // 登録済みの最新コメントを取得 CommentStruct prevComment = new CommentStruct(); if (CommentList.Count > 0) { prevComment = CommentList[CommentList.Count - 1]; } // 新しいコメントから順にチェック int iStPos = 0; // 未登録のコメントの開始位置 for (int iComment = workCommentList.Count - 1; iComment >= 0; iComment--) { CommentStruct tagtComment = workCommentList[iComment]; // 登録済みかチェック if (tagtComment.Id == prevComment.Id) { iStPos = iComment + 1; // 登録済みのコメントの次のコメントが未登録の開始位置 System.Diagnostics.Debug.WriteLine("found stored comment."); break; } } if (iStPos == workCommentList.Count) { // すべて登録済み return; } // 新規分だけ登録 for (int iComment = iStPos; iComment < workCommentList.Count; iComment++) { CommentStruct tagtComment = workCommentList[iComment]; // 新規のコメントの場合、リストに追加する CommentList.Add(tagtComment); System.Diagnostics.Debug.WriteLine("■{0} {1} {2}", tagtComment.UserName, tagtComment.Text, tagtComment.TimeStr); System.Diagnostics.Debug.WriteLine("■ThumbUrl " + tagtComment.UserThumbUrl); // 最大コメント数チェック if (CommentList.Count > MaxStoredCommentCnt) { CommentList.RemoveAt(0); System.Diagnostics.Debug.Assert(CommentList.Count == MaxStoredCommentCnt); } if (OnCommentReceiveEach != null) { OnCommentReceiveEach(this, tagtComment); } } if (OnCommentReceiveDone != null) { OnCommentReceiveDone(this); } }
/// <summary> /// コメント行の追加を行います。 /// </summary> public void AddComment(string comment) { if (string.IsNullOrEmpty(comment)) { return; } CommentList.Add(comment); }
//public string AuctionCommentIndent(int cid) { // // considering this is all cached, this should be highly efficient // var str = ""; // var parentCommentID = Comment.LoadID(cid).ParentCommentID; // if (parentCommentID == null) { // str = ""; // } else { // var parentparentCommentID = Comment.LoadID(parentCommentID.Value).ParentCommentID; // str = parentparentCommentID == null ? " class=\"reply1\"" : " class=\"reply2\""; // } // return str; //} //public static CommentList GetCommentHierarchy(Auction auction=null, BuyNowItem buyNow=null) { // var fkName = auction!=null? "auctionID": "buyNowItemID"; // var fkValue = auction!=null? auction.ID: buyNow.ID; // var hierarchy = new CommentList(); // var comments = CommentList.Load(new Sql("select * from Comment where "+fkName+"=", fkValue, "and status=", Comment.CommentStatus.Approved.ToString().SqlizeText(), " order by CommentDate Desc")); // foreach (var comment in comments) { // if (comment.ParentCommentID == null) { // // top level comment // comment.Depth = 0; // hierarchy.Add(comment); // AddChildren(hierarchy, comment, 1, comments); // } // } // return hierarchy; //} private static void AddChildren(CommentList hierarchy, Comment parentComment, int depth, CommentList allComments) { foreach (var checkComment in allComments) { if (checkComment.ParentCommentID == parentComment.ID) { var childComment = checkComment; childComment.Depth = depth; hierarchy.Add(childComment); AddChildren(hierarchy, childComment, depth + 1, allComments); } } }
public void OnShowAll() { bool check = true; if (check) { if (Selected == null) { List <City> listaGradova = new List <City>(); CitiesList.Clear(); City c = new City(); listaGradova = c.GetAllCitiesListDone(); foreach (var item in listaGradova) { CitiesList.Add(item); } List <Comment> com = new List <Comment>(); Comment ccc = new Comment(); CommentList.Clear(); com = ccc.GetAllComment(); foreach (var item in com) { CommentList.Add(item); } } else { List <City> listaGradova = new List <City>(); City c = new City(); c.CityName = Selected.CityName; List <Comment> com = new List <Comment>(); Comment ccc = new Comment(); CommentList.Clear(); com = ccc.GetAllCommentSelected(c.CityName.ToString()); foreach (var item in com) { CommentList.Add(item); } Selected = null; } } }
private void InitCommentInfo() { if (CommentList.Count == 0) { CommentList.Add(new GroupComments() { GroupName = StringUtil.GetCommentGroupName(CommentType.Long, CurrentStoryExtraInfo.long_comments.ToString()) }); CommentList.Add(new GroupComments() { GroupName = StringUtil.GetCommentGroupName(CommentType.Short, CurrentStoryExtraInfo.short_comments.ToString()) }); } }
private void InitCommentInfo() { if (CommentList.Count == 0) { CommentList.Add(new GroupComments() { GroupName = StringUtil.GetCommentGroupName(CommentType.Recommend, CurrentStoryExtraInfo.Count.Post_Reasons.ToString()) }); CommentList.Add(new GroupComments() { GroupName = StringUtil.GetCommentGroupName(CommentType.Normal, CurrentStoryExtraInfo.Count.Normal_Comments.ToString()) }); } }
public async Task Init() { List <Data.Model.Comment> comments = await _CommentService.Get <List <Data.Model.Comment> >(new CommentSearchRequest { MovieAndTvshowId = mtvs.Id }); comments = comments.OrderBy(x => x.DateTimeOfComment).ToList(); CommentList.Clear(); foreach (var item in comments) { CommentList.Add(item); } }
internal static CommentList getCommentsList(HttpResponseMessage responce) { var commentList = new CommentList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("comments")) { var commentsArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["comments"].ToString()); foreach(var commentObj in commentsArray) { var comment = new Comment(); comment = JsonConvert.DeserializeObject<Comment>(commentObj.ToString()); commentList.Add(comment); } } return commentList; }
internal static CommentList getCommentsList(HttpResponseMessage responce) { var commentList = new CommentList(); var jsonObj = JsonConvert.DeserializeObject <Dictionary <string, object> >(responce.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("comments")) { var commentsArray = JsonConvert.DeserializeObject <List <object> >(jsonObj["comments"].ToString()); foreach (var commentObj in commentsArray) { var comment = new Comment(); comment = JsonConvert.DeserializeObject <Comment>(commentObj.ToString()); commentList.Add(comment); } } return(commentList); }
public void Add(NicoNicoCommentEntry entry) { CommentList.Add(entry); }