Esempio n. 1
0
        /// <summary>
        /// performs auto updates from the default feed.
        /// </summary>
        public static void autoUpdateController(AppManager app)
        {
            Packages packages = new Packages();
            var      feeds    = FeedManager.getAutoUpdateFeeds();

            if (feeds.Count > 0)
            {
                Update update = new Update(packages, app);
                update.autoUpdate();
            }
        }
Esempio n. 2
0
        private void ExtensionManagerForm_Load(object sender, EventArgs e)
        {
            tabControl.SelectedTab = tabOnline;

            if (FeedManager.getAutoUpdateFeeds().Count > 0)
            {
                checkBox1.Checked = true;
            }

            SearchAndClearIcons();
        }
Esempio n. 3
0
        //Cycle through feeds from settings and call autoupdate function. If any updates occur, show message box.
        public static void autoUpdateController(AppManager app, ExtensionManagerForm form)
        {
            List <String> updatesOccurred = new List <String>();
            Packages      packages        = new Packages();

            System.Collections.Specialized.StringCollection feeds = FeedManager.getAutoUpdateFeeds();
            Update update = new Update(packages, null, app);

            if (update.IsOnline() == true)
            {
                foreach (String feed in feeds)
                {
                    packages.SetNewSource(feed);
                    update = new Update(packages, null, app);
                    updatesOccurred.AddRange(update.autoUpdate());
                }
            }

            if (updatesOccurred.Count > 0)
            {
                String begin;
                if (updatesOccurred.Count == 1)
                {
                    begin = "The following extension has been updated:";
                }
                else
                {
                    begin = "The following extensions have been updated:";
                }

                StringBuilder sb = new StringBuilder();
                sb.AppendLine(begin);
                sb.AppendLine();
                for (int i = 0; i < updatesOccurred.Count && i < 25; i++)
                {
                    sb.AppendLine("-" + updatesOccurred.ElementAt(i));
                }
                if (updatesOccurred.Count > 25)
                {
                    sb.AppendLine("...");
                }
                sb.AppendLine();
                sb.Append("Updates will finish when HydroDesktop is restarted.");
                sb.AppendLine("\n\n      Do you want to restart HydroDesktop now?");

                DialogResult dialogResult = MessageBox.Show(sb.ToString(), "Update Complete", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    System.Diagnostics.Process.Start(Application.ExecutablePath);
                    Environment.Exit(-1);
                }
                form.AutoUpdateRestartNeccesary();
            }
        }