C# Class AmazonScrape.MainWindow

Interaction logic for MainWindow.xaml
Inheritance: System.Windows.Window
Show file Open project: ThomasRush/AmazonScrape

Public Methods

Method Description
MainWindow ( ) : System

Private Methods

Method Description
AddResultToGrid ( AmazonItem result ) : void

Takes a validated result and adds it to the datagrid

AppendStatusMessage ( string message ) : void

Displays a work progress message in the status textbox. Right now this only displays items that have failed validation. Mostly this is there to show that the application is working and isn't stalled out.

CancelSearch ( ) : void

Called when the user cancels a search. May take a few seconds while it waits for the async thread to be ready.

GetSearchCriteria ( ) : SearchCriteria

Obtains the current control values and returns a SearchCriteria object. Note: does not validate the controls; perform validation before calling.

MainWindow_Loaded ( object sender, RoutedEventArgs e ) : void
OpenInBrowser_Click ( object sender, RoutedEventArgs e ) : void

Obtains the selected result item's URL and attempts to open the user's default web browser to that page.

OpenWebpage ( string url ) : void

Attempts to open the user's default web browser and direct it to the supplied url.

ScrapeComplete ( object sender, RunWorkerCompletedEventArgs e ) : void

Returns the state of the application to "search mode" after a search is complete.

ScraperProgressChanged ( object sender, ProgressChangedEventArgs args ) : void

Called whenever a result comes back. Updates the progress bars.

Search ( ) : void

Validates controls, obtains the control values, and begins the asynchronous scraping / parsing / result handling process.

SearchControl_KeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void
ShowSearchCriteriaGrid ( ) : void

Makes the search criteria controls visible again after a search is completed (or canceled).

ShowSearchProgressGrid ( ) : void

Replaces the search controls with "search progress" controls when a user searches A cancel button and a text area that displays which items were excluded from the results.

ValidateControls ( ) : Result

Loop through each control marked as validatable and check its validation status. If a single control is not valid (Status.Error), validation stops and the ValidationResult is immediately returned.

btnCancel_Click ( object sender, RoutedEventArgs e ) : void

Cancels an ongoing search.

btnSearch_Click ( object sender, RoutedEventArgs e ) : void
dataGrid_MouseDoubleClick ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

Double clicking a result item will attempt to open the item's URL in whatever program they have associated with URLs.

dataGrid_PreviewMouseLeftButtonDown ( object sender, System.Windows.Input.MouseButtonEventArgs e ) : void

If the user clicks in a data grid area that is not a result, remove the grid selection.

textBox_KeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void

Method Details

MainWindow() public method

public MainWindow ( ) : System
return System