rearrange order of OnBeforeShutdown and OnStopping - why are there two of these?

This commit is contained in:
Michael Becker 2022-09-13 09:42:38 -04:00
parent 13da008241
commit 2c11c39ff0
No known key found for this signature in database
GPG Key ID: DA394832305DA332

View File

@ -493,17 +493,19 @@ namespace MBS.Framework
Stopping = true; Stopping = true;
System.ComponentModel.CancelEventArgs ce = new System.ComponentModel.CancelEventArgs(); System.ComponentModel.CancelEventArgs ce = new System.ComponentModel.CancelEventArgs();
OnStopping(ce);
if (ce.Cancel)
return;
ce = new System.ComponentModel.CancelEventArgs();
OnBeforeShutdown(ce); OnBeforeShutdown(ce);
if (ce.Cancel) if (ce.Cancel)
{ {
return; return;
} }
ce = new System.ComponentModel.CancelEventArgs();
// OnStopping called after setting Stopping to True, otherwise there is no real difference
OnStopping(ce);
if (ce.Cancel)
return;
StopInternal(exitCode); StopInternal(exitCode);
OnShutdown(EventArgs.Empty); OnShutdown(EventArgs.Empty);