Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Return true to allow the application to terminate</returns>
        public static bool ApplicationShouldTerminate()
        {
            Logger.debug("ApplicationShouldTerminate");

            // Determine if there are any running transfers
            bool terminate = TransferController.ApplicationShouldTerminate();

            if (!terminate)
            {
                return(false);
            }

            // Determine if there are any open connections
            foreach (BrowserController controller in new List <BrowserController>(Browsers))
            {
                if (PreferencesFactory.get().getBoolean("browser.serialize"))
                {
                    if (controller.IsMounted())
                    {
                        // The workspace should be saved. Serialize all open browser sessions
                        Host serialized =
                            new HostDictionary().deserialize(
                                controller.Session.getHost().serialize(SerializerFactory.get()));
                        serialized.setWorkdir(controller.Workdir);
                        Application._sessions.add(serialized);
                    }
                }
            }
            return(true);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Return true to allow the application to terminate</returns>
        public static bool ApplicationShouldTerminate()
        {
            Logger.debug("ApplicationShouldTerminate");
            // Check if the automatic updater wants to install an update
            if (UpdateController.Instance.AboutToInstallUpdate)
            {
                return(true);
            }

            // Determine if there are any running transfers
            bool terminate = TransferController.ApplicationShouldTerminate();

            if (!terminate)
            {
                return(false);
            }

            // Determine if there are any open connections
            foreach (BrowserController controller in new List <BrowserController>(Browsers))
            {
                if (Preferences.instance().getBoolean("browser.serialize"))
                {
                    if (controller.IsMounted())
                    {
                        // The workspace should be saved. Serialize all open browser sessions
                        Host serialized = new Host(controller.getSession().getHost().getAsDictionary());
                        serialized.setWorkdir(controller.Workdir.getAbsolute());
                        Application._sessions.add(serialized);
                    }
                }
            }
            return(true);
        }