Should Application.Current.Shutdown()
NOT be used as a best practice to close a WPF application?
I have a small, multiple window application and the \"s
MainWindow.Close
won't even do anything if the ShutdownMode is not set respectively. You can do what you want, it should just fit what one expects.
(Shutdown
will ignore the fact that some Closing
event was cancelled, so that would be one thing you need to take into consideration)
Also:
Shutdown is implicitly called by Windows Presentation Foundation (WPF) in the following situations:
When ShutdownMode is set to OnLastWindowClose.
When the ShutdownMode is set to OnMainWindowClose.
When a user ends a session and the SessionEnding event is either unhandled, or handled without cancellation.