Exemplo n.º 1
0
 protected virtual void OnProductParsed(ParserEventArgs args)
 {
     if (ProductParsed != null)
     {
         ProductParsed(this, args);
     }
 }
Exemplo n.º 2
0
 protected virtual void OnFoundProductLink(ParserEventArgs args)
 {
     if (FoundProductLink != null)
     {
         FoundProductLink(this, args);
     }
 }
Exemplo n.º 3
0
 protected virtual void OnFoundCategory(ParserEventArgs args)
 {
     if (FoundCategory != null)
     {
         FoundCategory(this, args);
     }
 }
Exemplo n.º 4
0
 void target_FoundProductLink(object sender, ParserEventArgs e)
 {
     Trace.WriteLine(String.Format("Product link found: {0}",e.ProductLink));
       productCount++;
 }
Exemplo n.º 5
0
 private void target_FoundCategory(object sender, ParserEventArgs e)
 {
     Trace.WriteLine(String.Format("Category found: {0} {1}", e.CategoryName, e.CategoryLink));
       categoryCount++;
 }
Exemplo n.º 6
0
 void target_ProductParsed(object sender, ParserEventArgs e)
 {
     Trace.WriteLine(String.Format("Product parsed: {0}", e.Product.ToString()));
       ;
       Assert.IsNotNull(e.Product);
       Assert.IsTrue(!String.IsNullOrEmpty(e.Product.Name));
       Assert.IsTrue(!Double.IsNaN(e.Product.Price));
 }
Exemplo n.º 7
0
 protected override void OnFoundProductLink(ParserEventArgs args)
 {
     base.OnFoundProductLink(args);
 }
Exemplo n.º 8
0
 protected override void OnFoundCategory(ParserEventArgs args)
 {
     base.OnFoundCategory(args);
 }
Exemplo n.º 9
0
 protected virtual void OnProductParsed(ParserEventArgs args)
 {
     if (ProductParsed != null)
      ProductParsed(this, args);
 }
Exemplo n.º 10
0
 protected virtual void OnFoundProductLink(ParserEventArgs args)
 {
     if (FoundProductLink != null)
        FoundProductLink(this, args);
 }
Exemplo n.º 11
0
 protected virtual void OnFoundCategory(ParserEventArgs args)
 {
     if (FoundCategory != null)
        FoundCategory(this, args);
 }
Exemplo n.º 12
0
 void _parser_ProductParsed(object sender, ParserEventArgs e)
 {
     Products.Add(e.Product);
 }
Exemplo n.º 13
0
        void _parser_FoundProduct(object sender, ParserEventArgs e)
        {
            Trace.WriteLine(String.Format("Thread {0} Product found: {1} {2}", Thread.CurrentThread.ManagedThreadId, e.ParentCategoryId, e.ProductLink));

              var task = _factory.StartNew<HtmlDocument>(() => { return _client.Load(e.ProductLink); }).ContinueWith(
            (t) => _parser.ParseProductPage(t.Result, e.CategoryName));
        }
Exemplo n.º 14
0
        private void parser_FoundCategory(object sender, ParserEventArgs e)
        {
            Trace.WriteLine(String.Format("Thread {0} Category found: {1} {2}", Thread.CurrentThread.ManagedThreadId, e.CategoryName, e.CategoryLink));

            var task = _factory.StartNew<HtmlDocument>(() => { return _client.Load(e.CategoryLink); }).ContinueWith(
            (t) => _parser.ParseCategoryPage(t.Result, e.ParentCategoryId));

            _tasks.Add(task);
        }