Пример #1
0
        /// <summary>
        /// Creates a new comments instance.
        /// </summary>
        /// <param name="config">A crawler configuration object.</param>
        public CrawlerComments(CrawlerConfig config)
        {
            // Set the configuration.
            this.config = config;

            // Create the videos comments.
            this.commentsVideos = new CrawlerCommentsList(this.config.CommentsVideosFileName);

            // Create the users comments.
            this.commentsUsers = new CrawlerCommentsList(this.config.CommentsUsersFileName);

            // Create the playlists comments.
            this.commentsPlaylists = new CrawlerCommentsList(this.config.CommentsPlaylistsFileName);
        }
Пример #2
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="comments">A crawler object.</param>
        public void Initialize(CrawlerCommentsList comments, CrawlerComment.CommentType commentType)
        {
            this.comments = comments;
            this.formAdd.CommentType = commentType;
            this.Enabled = true;

            if ((int)commentType < commentTypeHeader.Length)
            {
                this.columnHeaderItem.Text = ControlComments.commentTypeHeader[(int)commentType];
                this.panelComments.Title = ControlComments.commentTypeTitle[(int)commentType];
            }

            // Populate the comments list.
            foreach (CrawlerComment comment in this.comments)
            {
                // Add a new list view item.
                ListViewItem item = new ListViewItem(new string[] { comment.Time.ToString(), comment.Item, comment.User, comment.Text }, 0);
                item.Tag = comment;
                this.listView.Items.Add(item);
            }

            this.buttonExport.Enabled = this.listView.Items.Count > 0;
        }