private void OnNewComment(InterfaceComment comment) { ListViewItem itemComment = new ListViewItem(new string[] { "", "", "" }); itemComment.Tag = comment; CommentToItem(comment, itemComment); lock (this) { Items.Add(itemComment); } }
private void m_UpdateOrAddComment(InterfaceComment comment) { bool updated = false; foreach (ListViewItem itemComment in this.Items) { if (itemComment.SubItems[2].Text == comment.Comment) { CommentToItem(comment, itemComment); updated = true; break; } } if (!updated) { OnNewComment(comment); } }
private void CommentToItem(InterfaceComment comment, ListViewItem itemComment) { if (comment == null) { return; } if (itemComment.SubItems[0].Text != comment.ClientName) { itemComment.SubItems[0].Text = comment.ClientName; } if (itemComment.SubItems[1].Text != comment.Rating) { itemComment.SubItems[1].Text = comment.Rating; } if (itemComment.SubItems[2].Text != comment.Comment) { itemComment.SubItems[2].Text = comment.Comment; } //itemComment.Tag=comment; }