C# Class GSF.Threading.ShutdownHandler

This class will monitor the state to the application and raise events when it detects that the application is about to shutdown.
Mostra file Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
Initialize ( ) : void

Initializes the shutdown handler. This is recommended to put in main loop of the program, but it is not critical.

TryRegisterCallback ( System.Action callback, ShutdownHandlerOrder shutdownOrder = ShutdownHandlerOrder.Default ) : bool

Attempts Registers a callback that will be called when the application is shutdown.

Private Methods

Method Description
InitiateSafeShutdown ( ) : void
InitiateSafeShutdown ( object sender, EventArgs e ) : void
ShutdownHandler ( ) : System

Method Details

Initialize() public static method

Initializes the shutdown handler. This is recommended to put in main loop of the program, but it is not critical.
public static Initialize ( ) : void
return void

TryRegisterCallback() public static method

Attempts Registers a callback that will be called when the application is shutdown.
public static TryRegisterCallback ( System.Action callback, ShutdownHandlerOrder shutdownOrder = ShutdownHandlerOrder.Default ) : bool
callback System.Action the callback when the shutdown occurs
shutdownOrder ShutdownHandlerOrder the order that the callback will occur.
return bool