C# Class Te.StahpIt.StahpIt

Interaction logic for App.xaml
Inheritance: System.Windows.Application
Mostrar archivo Open project: TechnikEmpire/StahpIt-WPF Class Usage Examples

Private Properties

Property Type Description
DoBackgroundInit void
DoInit void
EstablishTrustWithFirefox void
FirewallCheck bool
InitEngine void
InitTrayIcon void
InitViews void
InitWinsparkle void
LoadProgramState void
MinimizeToTray void
OnApplicationShutdown void
OnBackgroundInitComplete void
OnClearAllStatsRequest void
OnElementsBlocked void
OnError void
OnInfo void
OnRequestBlocked void
OnUnhandledException void
OnViewChangeRequest void
OnWarning void
SaveProgramState void
WinSparkleCheckIfShutdownOkay int
WinSparkleRequestsShutdown void

Public Methods

Method Description
BringAppToFocus ( ) : void

Brings the main application window into focus for the user and removes it from the tray if the application icon is in the tray.

StahpIt ( ) : Newtonsoft.Json

Protected Methods

Method Description
OnStartup ( System.Windows.StartupEventArgs e ) : void

Entry point for the application.

Private Methods

Method Description
DoBackgroundInit ( object sender, DoWorkEventArgs e ) : void
DoInit ( ) : void

Calls all other init methods, which are split up into ordered, logical groupings.

EstablishTrustWithFirefox ( ) : void

Detects if FireFox is installed and attempts to install the current CA as a trusted CA into all discovered FireFox profiles.

FirewallCheck ( string binaryFullPath ) : bool

Callback for the Engine to determine if the given binary should be filtered or not. The reason why this callback is named FirewallCheck is because the transparent proxy that the Engine employs could theoretically allow an application access to the internet even when the installed firewall has not necessarily given permission for this particular application to have internet access. This also why users are told this in plain text in the UI component for enabling/disabling filtering on applications.

InitEngine ( ) : void
InitTrayIcon ( ) : void

Initializes the m_trayIcon member, loading the icon graphic and hooking appropriate handlers to respond to user iteraction requesting to bring the application back out of the tray.

InitViews ( ) : void

Inits all the various views for the application, which will be pushed and popped on the primary window as requested or required.

InitWinsparkle ( ) : void

Inits all the callbacks for WinSparkle, so that when we call for update checks and such, it has all appropriate callbacks to request app shutdown, restart, etc, to allow for updating.

LoadProgramState ( ) : void

Loads the models, if present, from their serialized JSON files.

MinimizeToTray ( bool showTip = false ) : void

Sends the application to the task tray, optionally showing a tooltip explaining that the application is now hiding away, and how to correctly exit the application, if that's what the user desires.

OnApplicationShutdown ( object sender, System.Windows.ExitEventArgs e ) : void
OnBackgroundInitComplete ( object sender, RunWorkerCompletedEventArgs e ) : void
OnClearAllStatsRequest ( object sender ) : void

Handler for when the user requests, via the Statistics View, program-wide deletion of stats.

OnElementsBlocked ( uint numElementsRemoved, string fullRequest ) : void

Callback for when the Engine notifies that HTML elements have been removed from a HTML payload based on CSS selectors.

OnError ( string message ) : void

Callback for when the Engine reports a handled error.

OnInfo ( string message ) : void

Callback for when the Engine generates general information. This can be very verbose, non-critical information. Usually best to simply ignore.

OnRequestBlocked ( byte category, uint payloadSizeBlocked, string fullRequest ) : void

Callback for when the Engine notifies that a HTTP transaction was blocked from completing.

OnUnhandledException ( object sender, UnhandledExceptionEventArgs e ) : void
OnViewChangeRequest ( object sender, ViewChangeRequestArgs e ) : void

Callback for when a change in the current view has been requested.

OnWarning ( string message ) : void

Callback for when the Engine issues a warning. A warning is a handled situation that is non-fatal but is determined to potentially warrant closer inspection.

SaveProgramState ( ) : void

Serializes the models simply using JSON.

WinSparkleCheckIfShutdownOkay ( ) : int

Called by WinSparkle when it wants to check if it is alright to shut down this application in order to install an update.

WinSparkleRequestsShutdown ( ) : void

Called by WinSparkle when it has confirmed that a shutdown is okay and WinSparkle is ready to shut this application down so it can install a downloaded update.

Method Details

BringAppToFocus() public method

Brings the main application window into focus for the user and removes it from the tray if the application icon is in the tray.
public BringAppToFocus ( ) : void
return void

OnStartup() protected method

Entry point for the application.
protected OnStartup ( System.Windows.StartupEventArgs e ) : void
e System.Windows.StartupEventArgs /// Arguments passed to the executable at launch. ///
return void

StahpIt() public method

public StahpIt ( ) : Newtonsoft.Json
return Newtonsoft.Json