|
|
Events Class |
The Events type exposes the following members.
| Name | Description | |
|---|---|---|
| DisableRaisingEvents | Enables the raising of console application Events. | |
| EnableRaisingEvents | Enables the raising of console application Events. Prior to calling this method, handlers must be defined for the Events raised by a console application. |
| Name | Description | |
|---|---|---|
| BreakKeyPress | Occurs when CTRL+BREAK signal is received from keyboard input. | |
| CancelKeyPress | Occurs when CTRL+C signal is received from keyboard input. | |
| ConsoleClosing | Occurs when the user closes the console application window. | |
| SystemShutdown | Occurs when the system is shutting down. | |
| UserLoggingOff | Occurs when the user is logging off. |
using System; using GSF.Console; class Program { static void Main(string[] args) { // Subscribe to console events. Events.CancelKeyPress += Events_CancelKeyPress; Events.ConsoleClosing += Events_ConsoleClosing; Events.EnableRaisingEvents(); Console.ReadLine(); } static void Events_CancelKeyPress(object sender, System.ComponentModel.CancelEventArgs e) { // Abort processing. } static void Events_ConsoleClosing(object sender, System.ComponentModel.CancelEventArgs e) { // Put clean-up code. } }