I'm a big fan of taking control of every possible situation on the computer when it comes to making apps. And now that I'm beginning to use favor WPF over WinForms for some things, I'm also beginning to realize that many really cool things are missing in WPF - and searching for alternatives seems to be a never-ending struggle.
Is there an alternative in WPF to e.CloseReason
for WinForms?
The different "reasons" manifest as separate events. The Closing
and Closed
events are related to explicitly closing a window, either programmatically or via Alt+F4 or the close button. The Application.SessionEnding event happens at a shutdown or logoff, and information is exposed by ReasonSessionEnding. The exit code from the process can be read from ApplicationExitCode of the Application.Exit event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With