public void UpdatePackageSources(Protocol.PackageSource[] sources)
        {
            // Ignore the aggregate source. The PowerShell cmdlets need real sources.
            packageSources = sources
                             .Where(currentSource => !currentSource.IsAggregate)
                             .Select(source => source.ToNuGetPackageSource()).ToList();

            PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
        }
        private void OnSourceProviderSourcesChanged(object sender, EventArgs e)
        {
            lock (_gate)
            {
                // Reset the task for loading package sources.
                _packageSourcesAsync = null;
            }

            PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
        }
        private void OnSourceProviderSourcesChanged(object sender, EventArgs e)
        {
            if (!this.IsForeground())
            {
                this.InvokeBelowInputPriority(() => OnSourceProviderSourcesChanged(sender, e));
                return;
            }

            this.AssertIsForeground();

            PackageSources = _packageServices.GetSources(includeUnOfficial: true, includeDisabled: false)
                             .Select(r => new PackageSource(r.Key, r.Value))
                             .ToImmutableArrayOrEmpty();

            PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 4
0
        private void OnSourceProviderSourcesChanged(object sender, EventArgs e)
        {
            if (!this.IsForeground())
            {
                this.InvokeBelowInputPriorityAsync(() => OnSourceProviderSourcesChanged(sender, e));
                return;
            }

            this.AssertIsForeground();

            try
            {
                PackageSources = _packageServices.GetSources(includeUnOfficial: true, includeDisabled: false)
                                 .Select(r => new PackageSource(r.Key, r.Value))
                                 .ToImmutableArrayOrEmpty();
            }
            catch (Exception ex) when(ex is InvalidDataException || ex is InvalidOperationException)
            {
                // These exceptions can happen when the nuget.config file is broken.
                PackageSources = ImmutableArray <PackageSource> .Empty;
            }

            PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Fires event PackageSourcesChanged
 /// </summary>
 private void OnPackageSourcesChanged()
 {
     PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 6
0
 internal void SetPackageSources(IEnumerable <NuGetFeedBase> feeds)
 {
     _packageSources.Clear();
     _packageSources.AddRange(feeds.Select(f => f.PackageSource));
     PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
 }
 public void FirePackageSourcesChanged()
 {
     PackageSourcesChanged?.Invoke(this, new EventArgs());
 }
Exemplo n.º 8
0
 private void OnSourceProviderSourcesChanged(object sender, EventArgs e)
 {
     _packageSources = default;
     PackageSourcesChanged?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 9
0
 public void SavePackageSources(IEnumerable <PackageSource> sources)
 {
     PackageSources = sources;
     PackageSourcesChanged?.Invoke(this, null);
 }
 private void OnPackageSourcesChanged(object sender, IReadOnlyList <PackageSourceContextInfo> e)
 {
     PackageSourcesChanged?.Invoke(sender, e);
 }
        private void PackageSourceProvider_PackageSourcesChanged(object sender, EventArgs e)
        {
            List <PackageSourceContextInfo> packageSources = _sharedServiceState.SourceRepositoryProvider.PackageSourceProvider.LoadPackageSources().Select(packageSource => PackageSourceContextInfo.Create(packageSource)).ToList();

            PackageSourcesChanged?.Invoke(this, packageSources);
        }
Exemplo n.º 12
0
 internal void RaisePackageSourcesChanged(IReadOnlyList <PackageSourceContextInfo> packageSources)
 {
     PackageSourcesChanged?.Invoke(this, packageSources);
 }