expose CancelKeyPress as an overridable method on Application

This commit is contained in:
Michael Becker 2023-07-06 22:36:24 -04:00
parent 88a27eb26f
commit 935daede06

View File

@ -360,10 +360,22 @@ namespace MBS.Framework
if (ShortName == null) if (ShortName == null)
throw new ArgumentException("must specify a ShortName for the application"); throw new ArgumentException("must specify a ShortName for the application");
Console.CancelKeyPress += Console_CancelKeyPress;
InitializeInternal(); InitializeInternal();
Initialized = true; Initialized = true;
} }
protected virtual void OnCancelKeyPress(ConsoleCancelEventArgs e)
{
}
private void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
OnCancelKeyPress(e);
}
public event ApplicationActivatedEventHandler BeforeActivated; public event ApplicationActivatedEventHandler BeforeActivated;
protected virtual void OnBeforeActivated(ApplicationActivatedEventArgs e) protected virtual void OnBeforeActivated(ApplicationActivatedEventArgs e)
{ {