C# Class AmazonScrape.PageManager

Manages the workload of one page of search results. Calls appropriate methods to load, parse, validate and return results to the SearchManager.
Inheritance: System.ComponentModel.BackgroundWorker
显示文件 Open project: ThomasRush/AmazonScrape Class Usage Examples

Public Methods

Method Description
PageManager ( int pageNumber, SearchCriteria criteria, Func pageLoadMethod, ProgressChangedEventHandler updateProgressMethod, RunWorkerCompletedEventHandler workerCompleteMethod ) : System

Creates and dispatches a PageManager to load a search page, parse, extract, validate and return results using the parameter callback EventHandlers

ToString ( ) : string

Outputs useful information about the PageManager

Work ( object sender, DoWorkEventArgs e ) : void

Loads, chops up, parses and validates one page worth of results.

Private Methods

Method Description
ParseAndValidateProductHtml ( string html ) : Result

Parses and validates a single product's html, returning a Result containing error messages or the valid AmazonItem

Method Details

PageManager() public method

Creates and dispatches a PageManager to load a search page, parse, extract, validate and return results using the parameter callback EventHandlers
public PageManager ( int pageNumber, SearchCriteria criteria, Func pageLoadMethod, ProgressChangedEventHandler updateProgressMethod, RunWorkerCompletedEventHandler workerCompleteMethod ) : System
pageNumber int Which search page number to load
criteria SearchCriteria The user's search criteria
pageLoadMethod Func Supply the method to retrieve html
updateProgressMethod ProgressChangedEventHandler Callback for progress updates
workerCompleteMethod RunWorkerCompletedEventHandler Callback when work complete
return System

ToString() public method

Outputs useful information about the PageManager
public ToString ( ) : string
return string

Work() public method

Loads, chops up, parses and validates one page worth of results.
public Work ( object sender, DoWorkEventArgs e ) : void
sender object
e System.ComponentModel.DoWorkEventArgs
return void