private void UxFeedSelectionSelectedIndexChanged(object sender, EventArgs e)
        {
            string feedUrl = uxFeedSelection.SelectedIndex == 1 ? "https://nuget.org/api/v2/" : "https://www.myget.org/F/cuahsi/";

            _packages.SetNewSource(feedUrl);
            UpdatePackageList();
        }
Exemple #2
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();
            }
        }
Exemple #3
0
        private void OnFeedChanged()
        {
            string feedUrl = uxFeedSelection.SelectedItem.ToString();

            packages.SetNewSource(feedUrl);
            packs.DisplayPackages(uxPackages);
            Task.Factory.StartNew(() =>
            {
                RefreshUpdateList();
            });
        }
        private void uxFeedSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            string feedUrl;

            if (uxFeedSelection.SelectedIndex == 1)
            {
                feedUrl = "https://nuget.org/api/v2/";
            }
            else
            {
                feedUrl = "https://www.myget.org/F/cuahsi/";
            }

            packages.SetNewSource(feedUrl);
            this.UpdatePackageList();
        }
Exemple #5
0
        /// <summary>
        /// Syncs the lists of feeds to the one changed.
        /// </summary>
        /// <typeparam name="string"></typeparam>
        /// <param name="source">The source of the feed change.</param>
        /// <returns></returns>
        private void OnFeedChanged(string source)
        {
            string feedUrl;

            if (source == uxFeedSelection.Name)
            {
                if (uxFeedSelection.SelectedIndex != uxFeedSelection2.SelectedIndex)
                {
                    uxFeedSelection2.SelectedIndex = uxFeedSelection.SelectedIndex;
                    return;
                }

                feedUrl = uxFeedSelection.SelectedItem.ToString();
            }
            else
            {
                if (uxFeedSelection.SelectedIndex != uxFeedSelection2.SelectedIndex)
                {
                    uxFeedSelection.SelectedIndex = uxFeedSelection2.SelectedIndex;
                    return;
                }

                feedUrl = uxFeedSelection2.SelectedItem.ToString();
            }

            packages.SetNewSource(feedUrl);
            currentPageNumber = 0;
            DisplayPackagesAndUpdates();
            var dataService = packages.Repo as DataServicePackageRepository;

            if (dataService != null)
            {
                dataService.ProgressAvailable += new EventHandler <ProgressEventArgs>(dataService_ProgressAvailable);
            }
            var packageManager = packages.Manager;

            if (packageManager != null)
            {
                packageManager.PackageInstalling += new EventHandler <PackageOperationEventArgs>(Package_Installing);
            }
        }
Exemple #6
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();
            }
        }
Exemple #7
0
 private void DisplayPackages()
 {
     packages.SetNewSource(uxSelectedFeed.SelectedItem.ToString());
     UpdatePackageList();
 }
Exemple #8
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();
            foreach (String feed in feeds)
            {
                packages.SetNewSource(feed);
                Update 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.");

                MessageBox.Show(sb.ToString());
                form.AutoUpdateRestartNeccesary();
            }
        }