示例#1
0
        public void ShutDownAsync(object param)
        {
            model.Save();
            model.DownloadQueue.Save();
            connectionController.Exit();
            watchdogController.Stop();
            //Kill local overlord if running
            overlordManagerService.Stop();
            if (null != client)
            {
                client.Stop();
            }

            //Kill UI
            SafeObservableStatic.Dispatcher.Invoke(DispatcherPriority.Normal,
                                                   new Action(
                                                       delegate
            {
                if (null != mainWindowModel)
                {
                    popupController.Close();
                    mainWindowModel.Close();
                    trayIcon.Dispose();

                    model.GetShutdownLock();
                    singleInstanceService.Dispose();
                    System.Windows.Application.Current.Shutdown(0);
                }
            }
                                                       ));
        }