How to gracefully handle computer shutdown from WPF application: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
[[Category:Software development]] | [[Category:Software development]] | ||
[[File:WPF application lifetime.png|700px]] | [[File:WPF application lifetime.png|700px]] | ||
====Application Events==== | |||
* http://msdn.microsoft.com/en-us/library/ms588795.aspx | |||
=====When you start the application===== | |||
Startup -> Activated | |||
=====When you shut the application down normally (i.e. close main window)===== | |||
Deactivated -> Exit | |||
=====If user is logging out of or shutting down Windows===== | |||
Deactivated -> SessionEnding | |||
=====Application gets focus===== | |||
Activated | |||
=====Application loses focus===== | |||
Deactivated | |||
====AppDomain Events==== | |||
* http://msdn.microsoft.com/en-us/library/1dw188c1.aspx | |||
When an exception is not caught | |||
=====UnhandledException===== | |||
(DispatcherUnhandledException is raised by an Application for each exception that is unhandled by code running on the main UI thread, but if you can safely ignore that and wait for UnhandledException is raised by AppDomain) | |||
* [http://msdn.microsoft.com/en-us/library/windows/desktop/aa376877.aspx Application Shutdown Changes in Windows Vista] | * [http://msdn.microsoft.com/en-us/library/windows/desktop/aa376877.aspx Application Shutdown Changes in Windows Vista] |
Revision as of 14:35, 25 April 2014
Application Events
When you start the application
Startup -> Activated
When you shut the application down normally (i.e. close main window)
Deactivated -> Exit
If user is logging out of or shutting down Windows
Deactivated -> SessionEnding
Application gets focus
Activated
Application loses focus
Deactivated
AppDomain Events
When an exception is not caught
UnhandledException
(DispatcherUnhandledException is raised by an Application for each exception that is unhandled by code running on the main UI thread, but if you can safely ignore that and wait for UnhandledException is raised by AppDomain)