I don't know if you have noticed this. We often use the loaded () event in the page class to process some operations after page loading, such
Public page () {initializecomponent (); this. Loaded + = new routedeventhandler (page_loaded);} void page_loaded (Object sender, routedeventargs e ){}
However, the page class does not contain events such as exit () or quit (). How do we control the application behavior when the page is closed? In fact, we can use the app. Current. Exit () event to achieve this goal.
Public page () {initializecomponent (); app. Current. Exit + = new eventhandler (current_exit );}
Void current_exit (Object sender, eventargs e) {system. Windows. browser. htmlpage. Window. Alert ("Oh on ");}
Although the above "oh no" made me wrong... Is it easy?
Two other events may be useful to you.
App. Current. startup ()
App. Current. unhandledexception ()