public async void TestExtractPageCount()
       {
           var cnblogProcess=new CnblogProcess();
           var count=await cnblogProcess.ExtractCatalogPageCount(@"http://www.cnblogs.com/hqfz/default.aspx?page=2");
           Assert.Equal(5,count);

       }
        private async void OnGetUrls()
        {
            var cnblog = new CnblogProcess();
            var browser = new ScrapingBrowser();
            var htmlDocument = new HtmlDocument();
            var html = browser.DownloadString(new Uri("http://news.baidu.com"));
            htmlDocument.LoadHtml(html);
            var links = htmlDocument.DocumentNode.Descendants("a")
                .Where(x => x.Attributes.Contains("href"));

            var progress = new Progress<DownloadStringTaskAsyncExProgress>();
            Content = " ";
            var i = 0;

            progress.ProgressChanged += (s, e) =>
            {
                Content += e.Text + Environment.NewLine;
                ProgressValue = (double) i++/links.Count();
            };

            await OutputLinks(links, progress).ConfigureAwait(false);
        }
        private async void OnExport()
        {
            var articles = new List<Article>();
            foreach (var catalog in _catalogObservableList)
            {
                foreach (var article in catalog.ArticlesCollectionView)
                {
                    articles.Add(((ArticleViewModel) article).CurrentEntity);
                }
            }
            var progress = new Progress<DownloadStringTaskAsyncExProgress>();
            Content = " ";
            var i = 0;
            progress.ProgressChanged += (s, e) =>
            {
                Content += e.Text + "";
                ProgressValue = (double) i++/articles.Count();
            };

            IExporter exporter = new WebUtilityExpoter();
            IBlogProcess blogProcess = new CnblogProcess();

            await exporter.Export(CnBlogName, articles, blogProcess, progress);

            exporter = new EpubExporter();
            await exporter.Export(CnBlogName,articles, blogProcess, progress);
        }
        private async void OnParseUrl()
        {
            _catalogObservableList.Clear();

            var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            Content = "Analyzing...";
            await Task.Run(() =>
            {
                IBlogProcess blogProcess = new CnblogProcess();
                return blogProcess.ParseCatalogs(CnBlogName);
            }).ContinueWith(
                t =>
                {
                    Content = "Create tree...";

                    foreach (var catalog in t.Result)
                    {
                        var catalogViewModel = new CatalogNodeViewModel(catalog);

                        foreach (var article in catalog.Articles)
                        {
                            var articleViewModel = new ArticleViewModel(article);
                            catalogViewModel.AddArticle(articleViewModel);
                        }

                        _catalogObservableList.Add(catalogViewModel);
                    }

                    Content = "Analyzing is finished";
                }, scheduler);
        }