APPLICATION SHUTDOWN THOUGHTS

OnLastWindowClose
our application keeps running till last window is closed

OnMainWindowClose
This is the traditional approach

OnExplicitShutdown
call Application.Shutdown(). long-running background task or if you just want to use more complex logic to decide when your application should close