Exemplo n.º 1
0
        private async void Worker()
        {
            for (int i = parserSettings.StartPoint; i <= parserSettings.EndPoint; i++)
            {
                if (!isActive)
                {
                    OnComleted?.Invoke(this);
                    return;
                }
                HabrParserForm.idPage = i.ToString();


                var source = await loader.GetSoutseByPageId(i);

                var domParser = new HtmlParser();

                var document = await domParser.ParseDocumentAsync(source);

                var result = parser.Parse(document);

                OnNewData?.Invoke(this, result);
            }
            OnComleted?.Invoke(this);
            isActive = false;
        }
Exemplo n.º 2
0
        private async void Worker()
        {
            for (int i = parserSettings.startPage; i <= parserSettings.endPage; i++)
            {
                if (!isActive)
                {
                    OnComleted?.Invoke(this);
                    return;
                }
                var source = await htmlLoader.GetSourceByPageId(i);

                var domParser = new HtmlParser();

                var document = await domParser.ParseDocumentAsync(source);

                var result = parser.Parse(document);

                OnNewData?.Invoke(this, result);
            }
            OnComleted?.Invoke(this);
            isActive = false;
        }