Example #1
0
        /// <summary>
        /// кнопка поиска
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonFilter_Click(object sender, EventArgs e)
        {
            List <string> find;
            List <string> exclude;


            if (textBoxFind.Text.Trim().Length > 0)
            {
                find = textBoxFind.Text.Trim().ToLower().Replace(" ", "").Split(',').ToList();
            }
            else
            {
                find = null;
            }
            if (textBoxExclude.Text.Trim().Length > 0)
            {
                exclude = textBoxExclude.Text.Trim().ToLower().Replace(" ", "").Split(',').ToList();
            }
            else
            {
                exclude = null;
            }
            db.LoadAdvertKw(options.AdvertKeywordsFileName);
            List <Comment> comments = db.FindComments(find, exclude);

            comments = new CommentPrefilter(db).CountAdvertWords(comments);
            FormShowComments fsc = new FormShowComments(comments, db);

            fsc.Show(this);
        }
Example #2
0
        /// <summary>
        /// Конструктор с настройками
        /// </summary>
        /// <param name="options"></param>
        /// <param name="db"></param>
        public VK(Options options, CommentDatabase db)
        {
            this.options = options;
            this.db      = db;
            api          = new VkApi();
            db.LoadAdvertKw(options.AdvertKeywordsFileName);
            prefilter           = new CommentPrefilter(db);
            options.AccessToken = GetToken(options.ApplicationID);
            ApiAuthParams par = new ApiAuthParams
            {
                AccessToken = options.AccessToken
            };

            api.Authorize(par);   //Подключение
        }