iSpyApplication.MainForm.Exit C# (CSharp) Method

Exit() private method

private Exit ( ) : void
return void
        private void Exit()
        {
            try
            {
                SaveObjects("");
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            _shuttingDown = true;
            WsWrapper.Disconnect();
            try
            {
                MWS.StopServer();
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            ThreadKillDelay = 3000;

            _houseKeepingTimer?.Stop();
            _updateTimer?.Stop();
            _tmrJoystick?.Stop();

            if (Conf.ShowMediaPanel)
                Conf.MediaPanelSize = splitContainer1.SplitterDistance + "x" + splitContainer2.SplitterDistance;

            if (Conf.BalloonTips)
            {
                if (Conf.BalloonTips)
                {
                    notifyIcon1.BalloonTipText = LocRm.GetString("ShuttingDown");
                    notifyIcon1.ShowBalloonTip(1500);
                }
            }
            _closing = true;

            try
            {
                SaveConfig();
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            try
            {
                if (_talkSource != null)
                {
                    _talkSource.Stop();
                    _talkSource = null;
                }
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }
            try
            {
                if (_talkTarget != null)
                {
                    _talkTarget.Stop();
                    _talkTarget = null;
                }
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }
            try
            {
                RemoveObjects();
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            try
            {
                File.WriteAllText(Program.AppDataPath + "exit.txt", "OK");
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            if (StorageThreadRunning)
            {
                try
                {
                    _storageThread.Join(ThreadKillDelay);
                }
                catch
                {
                }
            }
            Logger.WriteLogs();
        }
MainForm