예제 #1
0
        public static void Quit()
        {
            Trace.Call();

            // only save windows size when we are not in the engine manager dialog
            if (_MainWindow.Visible)
            {
                // save window size
                int width, heigth;
                if (_MainWindow.IsMaximized)
                {
                    width  = -1;
                    heigth = -1;
                }
                else
                {
                    _MainWindow.GetSize(out width, out heigth);
                }
                _FrontendConfig[Frontend.UIName + "/Interface/Width"]  = width;
                _FrontendConfig[Frontend.UIName + "/Interface/Heigth"] = heigth;

                int x, y;
                _MainWindow.GetPosition(out x, out y);
                _FrontendConfig[Frontend.UIName + "/Interface/XPosition"] = x;
                _FrontendConfig[Frontend.UIName + "/Interface/YPosition"] = y;
                _FrontendConfig.Save();
            }

            if (_FrontendManager != null)
            {
                if (IsLocalEngine)
                {
                    try {
                        // dispose (possibly flush) all protocol managers / chats
                        lock (Session.ProtocolManagers) {
                            foreach (var protocolManager in Session.ProtocolManagers)
                            {
                                protocolManager.Dispose();
                            }
                        }
                    } catch (Exception ex) {
#if LOG4NET
                        _Logger.Error("Quit(): Exception", ex);
#endif
                    }
                }

                DisconnectEngineFromGUI();
            }

#if LOG4NET
            // HACK: workaround log4net deadlock issue. Not sure if it has any
            // effect though, see: https://www.smuxi.org/issues/show/876
            log4net.Core.LoggerManager.Shutdown();
#endif

            Gtk.Application.Quit();

            Environment.Exit(0);
        }
예제 #2
0
        public static void Quit()
        {
            Trace.Call();

            // only save windows size when we are not in the engine manager dialog
            if (_MainWindow.Visible)
            {
                // save window size
                int width, heigth;
                if (_MainWindow.IsMaximized)
                {
                    width  = -1;
                    heigth = -1;
                }
                else
                {
                    _MainWindow.GetSize(out width, out heigth);
                }
                _FrontendConfig[Frontend.UIName + "/Interface/Width"]  = width;
                _FrontendConfig[Frontend.UIName + "/Interface/Heigth"] = heigth;

                int x, y;
                _MainWindow.GetPosition(out x, out y);
                _FrontendConfig[Frontend.UIName + "/Interface/XPosition"] = x;
                _FrontendConfig[Frontend.UIName + "/Interface/YPosition"] = y;
                _FrontendConfig.Save();
            }

            if (_FrontendManager != null)
            {
                DisconnectEngineFromGUI();
            }

            Gtk.Application.Quit();

            Environment.Exit(0);
        }
예제 #3
0
        public static void Quit()
        {
            Trace.Call();

            // only save windows size when we are not in the engine manager dialog
            if (_MainWindow != null && _MainWindow.Visible)
            {
                // save window size
                int width, heigth;
                if (_MainWindow.IsMaximized)
                {
                    width  = -1;
                    heigth = -1;
                }
                else
                {
                    _MainWindow.GetSize(out width, out heigth);
                }
                _FrontendConfig[Frontend.UIName + "/Interface/Width"]  = width;
                _FrontendConfig[Frontend.UIName + "/Interface/Heigth"] = heigth;

                int x, y;
                _MainWindow.GetPosition(out x, out y);
                _FrontendConfig[Frontend.UIName + "/Interface/XPosition"] = x;
                _FrontendConfig[Frontend.UIName + "/Interface/YPosition"] = y;
                _FrontendConfig.Save();
            }

            if (_FrontendManager != null)
            {
                if (IsLocalEngine)
                {
                    try {
                        // shutdown session (flush message buffers)
                        Session.Shutdown();
                    } catch (Exception ex) {
#if LOG4NET
                        _Logger.Error("Quit(): Exception", ex);
#endif
                    }
                }

                // sync last seen message of current chat
                var currentChatView = _MainWindow.ChatViewManager.CurrentChatView;
                if (!UseLowBandwidthMode && currentChatView != null)
                {
                    currentChatView.UpdateLastSeenMessage();
                }
                // OPT: switch to Smuxi chat so switch page events are not
                // triggered when each chat gets removed
                _MainWindow.ChatViewManager.CurrentChatNumber = 0;

                DisconnectEngineFromGUI();
            }

#if LOG4NET
            // HACK: workaround log4net deadlock issue. Not sure if it has any
            // effect though, see: https://www.smuxi.org/issues/show/876
            log4net.Core.LoggerManager.Shutdown();
#endif

            if (IsGtkInitialized && InGtkApplicationRun)
            {
                Gtk.Application.Quit();
            }

            Environment.Exit(0);
        }