Application Shutdown options

Ways to shutdown ..
 OnLastWindowClose
 OnMainWindowClose
 OnExplicitShutdown

Chose here...

<Application x:Class="WpfApplication2.App"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 StartupUri="MainWindow.xaml" ShutdownMode="OnExplicitShutdown" >

 

Other important events

private void Application_DispatcherUnhandledException(object sender,
    System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{

}

private void Application_Exit(object sender, ExitEventArgs e)
{

}

private void Application_Startup(object sender, StartupEventArgs e)
{

}

private void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
{

}

private void Application_Activated(object sender, EventArgs e)
{

}