Пример #1
0
        /// <summary>
        /// Persist the package sources, which was add/removed via the Options page, to the VS Settings store.
        /// This gets called when users click OK button.
        /// </summary>
        internal bool ApplyChangedSettings()
        {
            // if user presses Enter after filling in Name/Source but doesn't click Add
            // the options will be closed without adding the source, try adding before closing
            // Only apply if nothing was added
            TryAddSourceResults result = TryAddSource();

            if (result != TryAddSourceResults.NothingAdded)
            {
                return(false);
            }

            // get package sources as ordered list
            var packageSources = PackageSourcesListBox.Items.Cast <PackageSource>().ToList();

            _packageSourceProvider.SetPackageSources(packageSources);
            // restore current active source if it still exists, or reset to aggregate source
            if (packageSources.Contains(_activeSource))
            {
                _packageSourceProvider.ActivePackageSource = _activeSource;
            }
            else
            {
                _packageSourceProvider.ActivePackageSource = _aggregateSource;
            }
            return(true);
        }
Пример #2
0
        private void OnAddButtonClick(object sender, EventArgs e)
        {
            TryAddSourceResults result = TryAddSource();

            if (result == TryAddSourceResults.NothingAdded)
            {
                MessageHelper.ShowWarningMessage(Resources.ShowWarning_NameAndSourceRequired, Resources.ShowWarning_Title);
                SelectAndFocus(NewPackageName);
            }
            UpdateUI();
        }