// Shutdown the App. // Note: The "post" in the method name is legacy. Now all of Application's shutdown work is complete // when this method returns. In particular, the managed Dispatcher is shut down. internal void PostShutdown() { Cleanup(); _proxyInstance = null; Application app = Application.Current; if (app != null) { XappLauncherApp launcherApp = app as XappLauncherApp; if (launcherApp != null) { launcherApp.AbortActivation(); Debug.Assert(Application.IsShuttingDown); } else { //this calls into the internal helper and is hardcoded for a clean // shutdown app.CriticalShutdown(0); // The Application.Exit event is raised in a Dispatcher callback at Normal priority. // Blocking on this callback here ensures that the event will be raised before we've // disconnected from the browser. An XBAP may want, in particular, to write a cookie. app.Dispatcher.Invoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate(object unused) { return(null); }), null); } } }
internal void PostShutdown() { this.Cleanup(); ApplicationProxyInternal._proxyInstance = null; Application application = Application.Current; if (application != null) { XappLauncherApp xappLauncherApp = application as XappLauncherApp; if (xappLauncherApp != null) { xappLauncherApp.AbortActivation(); return; } application.CriticalShutdown(0); application.Dispatcher.Invoke(DispatcherPriority.Normal, new DispatcherOperationCallback((object unused) => null), null); } }