C# Class OnlineVideos.Sites.BrowserUtilConnector

Base class for any browser util Implementations of this class will be passed to the OnlineVideos.Sites.WebAutomation.BrowserHost
Datei anzeigen Open project: offbyoneBB/mp-onlinevideos2 Class Usage Examples

Protected Properties

Property Type Description
_loadingPicture System.Windows.Forms.PictureBox

Public Methods

Method Description
BrowserDocumentComplete ( ) : EventResult

Method called when the DocumentComplete event is handled from the browser

HideLoading ( ) : void

Hide the loading image

Initialise ( System.Windows.Forms.WebBrowser browser, ILog messageHandler ) : void

Constructor - attach to the web browser supplied

InvokeScript ( string scriptToRun ) : void

Invoke javascript on the page

OnAction ( string actionEnumName ) : void

Allow implementations to handle actions which aren't handled by the browserhost Unfortunately, because of dependencies, we need to pass in the name of the action enumeration rather than the enum itself

OnClosing ( ) : void

Fired when the browser host is closing

Pause ( ) : EventResult

Pause button was pressed

PerformLogin ( string username, string password ) : EventResult

Perform a login to the target website

Play ( ) : EventResult

Play button was pressed, so resume playback

PlayVideo ( string videoToPlay ) : EventResult

Begin playback of the specified video The videoToPlay will be one of the parameters sent to the browserhost

RemoveFileFromTempInternetFiles ( string fileNameStartsWith, string fileExtension ) : void

Remove the specified files from temporary internet files

ShowLoading ( ) : void

Show a loading image

WaitForComplete ( Func forceQuit, int pollTimeout = 20 ) : bool

Poll ProcessComplete, waiting for the timeout (in seconds) Returns true if the process completed, otherwise we get false (a timeout)

Private Methods

Method Description
Browser_DocumentCompleted ( object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e ) : void

Pass the document completed event to the child connectors

RedirectOnError ( Exception ex ) : void

Log an error, detach the event handler and redirect to blank page

Method Details

BrowserDocumentComplete() public abstract method

Method called when the DocumentComplete event is handled from the browser
public abstract BrowserDocumentComplete ( ) : EventResult
return OnlineVideos.Sites.Entities.EventResult

HideLoading() public method

Hide the loading image
public HideLoading ( ) : void
return void

Initialise() public method

Constructor - attach to the web browser supplied
public Initialise ( System.Windows.Forms.WebBrowser browser, ILog messageHandler ) : void
browser System.Windows.Forms.WebBrowser
messageHandler ILog
return void

InvokeScript() public method

Invoke javascript on the page
public InvokeScript ( string scriptToRun ) : void
scriptToRun string
return void

OnAction() public method

Allow implementations to handle actions which aren't handled by the browserhost Unfortunately, because of dependencies, we need to pass in the name of the action enumeration rather than the enum itself
public OnAction ( string actionEnumName ) : void
actionEnumName string
return void

OnClosing() public method

Fired when the browser host is closing
public OnClosing ( ) : void
return void

Pause() public abstract method

Pause button was pressed
public abstract Pause ( ) : EventResult
return OnlineVideos.Sites.Entities.EventResult

PerformLogin() public abstract method

Perform a login to the target website
public abstract PerformLogin ( string username, string password ) : EventResult
username string
password string
return OnlineVideos.Sites.Entities.EventResult

Play() public abstract method

Play button was pressed, so resume playback
public abstract Play ( ) : EventResult
return OnlineVideos.Sites.Entities.EventResult

PlayVideo() public abstract method

Begin playback of the specified video The videoToPlay will be one of the parameters sent to the browserhost
public abstract PlayVideo ( string videoToPlay ) : EventResult
videoToPlay string
return OnlineVideos.Sites.Entities.EventResult

RemoveFileFromTempInternetFiles() public method

Remove the specified files from temporary internet files
public RemoveFileFromTempInternetFiles ( string fileNameStartsWith, string fileExtension ) : void
fileNameStartsWith string
fileExtension string
return void

ShowLoading() public method

Show a loading image
public ShowLoading ( ) : void
return void

WaitForComplete() public method

Poll ProcessComplete, waiting for the timeout (in seconds) Returns true if the process completed, otherwise we get false (a timeout)
public WaitForComplete ( Func forceQuit, int pollTimeout = 20 ) : bool
forceQuit Func
pollTimeout int
return bool

Property Details

_loadingPicture protected_oe property

protected PictureBox,System.Windows.Forms _loadingPicture
return System.Windows.Forms.PictureBox