private void Context_OnGobchatExit()
        {
            logger.Info("Start application shutdown");

            try
            {
                _appWorker?.Stop(true);
                _appWorker = null;
            }
            catch (Exception e)
            {
                logger.Warn(e, "Error in appWorker");
            }

            try
            {
                ApplicationShutdownProcess();
            }
            finally
            {
                _hiddenMainForm?.Dispose();
                _hiddenMainForm = null;
                logger.Info("Shutdown complete");
            }
        }
        public AbstractGobchatApplicationContext()
        {
            AbstractGobchatApplicationContext.OnGobchatExit += (s, e) => Context_OnGobchatExit();
            Application.ApplicationExit += (s, e) => OnApplicationExit();

            _hiddenMainForm = new Form();
            UISynchronizer  = new ContextSpecificUISynchronizer(WindowsFormsSynchronizationContext.Current);

            _appWorker = new IndependendBackgroundWorker();
            _appWorker.Start((token) => ApplicationStartupProcess(token));
        }