protected void ShowGroupPostComments(TreeNode node, LinkedInGroupPost post)
        {
            node.Nodes.Clear();

            foreach (LinkedInGroupComment comment in post.Comments)
            {
                TreeNode childNode = node.Nodes.Add(comment.Text.LimitLength(64));
                childNode.Tag = comment;
            }
        }
        protected void AddComment(LinkedInGroupPost post, string comment)
        {
            post.Comment(comment);

            // After posting the comment, add it to the post's comment collection, select it, and display the comment in the info box.
            tbComment.Text = "(posted)";
            TreeNode childNode = selectedPostNode.Nodes.Add(comment.LimitLength(64));

            tvGroups.SelectedNode = childNode;
            tbInfo.Text           = comment;
        }
        protected async void LoadCommentsForPost(TreeNode node, LinkedInGroupPost post)
        {
            LinkedInGetGroupPostCommentsOptions options = new LinkedInGetGroupPostCommentsOptions();

            options.CommentOptions.SelectAll();
            options.PostId = post.Id;
            ShowLoading(node);

            await Task.Run(() => post.LoadComments(options));

            ShowGroupPostComments(node, post);
            node.ExpandAll();
        }
 protected void OnNodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node.Tag is LinkedInGroup)
     {
         LinkedInGroup group = (LinkedInGroup)e.Node.Tag;
         LoadPostsForGroup(e.Node, group);
     }
     else if (e.Node.Tag is LinkedInGroupPost)
     {
         LinkedInGroupPost post = (LinkedInGroupPost)e.Node.Tag;
         LoadCommentsForPost(e.Node, post);
     }
 }
        protected void OnNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            if (e.Node.Tag is LinkedInGroup)
            {
                LinkedInGroup group = (LinkedInGroup)e.Node.Tag;
                sb.Append("Group: " + group.Name);
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("Category: " + group.Category);
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("Description: " + group.ShortDescription);
                btnComment.Enabled = false;
            }
            else if (e.Node.Tag is LinkedInGroupPost)
            {
                LinkedInGroupPost post = (LinkedInGroupPost)e.Node.Tag;
                sb.Append("Title: " + post.Title);
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("By: " + post.Creator.FirstName + " " + post.Creator.LastName);
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("On: " + post.CreationTime.ToString());
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("Summary: " + post.Summary);
                btnComment.Enabled = true;
                selectedPost       = post;
                selectedPostNode   = e.Node;
            }
            else if (e.Node.Tag is LinkedInGroupComment)
            {
                LinkedInGroupComment comment = (LinkedInGroupComment)e.Node.Tag;
                sb.Append("By: " + comment.Creator.FirstName + " " + comment.Creator.LastName);
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append("On: " + comment.CreationTime.ToString());
                sb.Append(CRLF);
                sb.Append(CRLF);
                sb.Append(comment.Text);
                btnComment.Enabled = true;
            }

            tbInfo.Text = sb.ToString();
        }
Exemple #6
0
        protected async void GetComments(string postId)
        {
            LinkedInGroupPost post  = posts[postId];
            LinkedInGroup     group = postGroup[post.Id];
            LinkedInGetGroupPostCommentsOptions commentOptions = new LinkedInGetGroupPostCommentsOptions();

            commentOptions.CommentOptions.SelectAll();
            commentOptions.PostId = post.Id;
            await Task.Run(() => post.LoadComments(commentOptions));

            foreach (LinkedInGroupComment comment in post.Comments)
            {
                CreateCarrier("LinkedInComment", signal =>
                {
                    signal.LinkedInGroup.Name.Text.Value = group.Name;
                    signal.LinkedInGroup.Id = group.Id;
                    signal.LinkedInPost.Title.Text.Value = post.Title;
                    signal.LinkedInPost.Id = post.Id;
                    signal.CreationTime    = comment.CreationTime;
                    signal.Comment         = comment.Text;
                    signal.LinkedInCommentCreator.PersonName.Name.Text.Value = comment.Creator.FirstName + " " + comment.Creator.LastName;
                });
            }
        }
Exemple #7
0
/*
 *                              foreach (LinkedInGroup group in groups.Result)
 *                              {
 *                                      LinkedInGetGroupPostsOptions postOptions = new LinkedInGetGroupPostsOptions();
 *                                      postOptions.PostOptions.SelectAll();
 *                                      postOptions.GroupId = group.Id;
 *                                      group.LoadPosts(postOptions);
 *
 *                                      foreach (LinkedInGroupPost post in group.Posts)
 *                                      {
 *                                              LinkedInGetGroupPostCommentsOptions commentOptions = new LinkedInGetGroupPostCommentsOptions();
 *                                              commentOptions.CommentOptions.SelectAll();
 *                                              commentOptions.PostId = post.Id;
 *                                              post.LoadComments(commentOptions);
 *
 *                                              foreach (LinkedInGroupComment comment in post.Comments)
 *                                              {
 *                                                      GroupPostComment c = new GroupPostComment() { Group = group, Post = post, Comment = comment };
 *                                                      comments.Add(c);
 *                                              }
 *                                      }
 *                              }
 *                      }
 */

        protected void AddComment(LinkedInGroupPost post, string comment)
        {
            post.Comment(comment);
        }