From 935daede06a74fac89ae873e9c397922172ba257 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Thu, 6 Jul 2023 22:36:24 -0400 Subject: [PATCH] expose CancelKeyPress as an overridable method on Application --- MBS.Framework/Application.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/MBS.Framework/Application.cs b/MBS.Framework/Application.cs index 87e18b1..949f014 100755 --- a/MBS.Framework/Application.cs +++ b/MBS.Framework/Application.cs @@ -360,10 +360,22 @@ namespace MBS.Framework if (ShortName == null) throw new ArgumentException("must specify a ShortName for the application"); + Console.CancelKeyPress += Console_CancelKeyPress; + InitializeInternal(); Initialized = true; } + protected virtual void OnCancelKeyPress(ConsoleCancelEventArgs e) + { + } + + private void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e) + { + OnCancelKeyPress(e); + } + + public event ApplicationActivatedEventHandler BeforeActivated; protected virtual void OnBeforeActivated(ApplicationActivatedEventArgs e) {