public PackageDetailControlModel(
     InstallationTarget target,
     UiSearchResultPackage searchResultPackage)
     : base(target, searchResultPackage)
 {
     Debug.Assert(!target.IsSolution);
     UpdateInstalledVersion();
 }
Exemple #2
0
 public PackageDetailControlModel(
     InstallationTarget target,
     UiSearchResultPackage searchResultPackage)
     : base(target, searchResultPackage)
 {
     Debug.Assert(!target.IsSolution);
     UpdateInstalledVersion();
 }
 public DetailControlModel(
     InstallationTarget target,
     UiSearchResultPackage searchResultPackage)
 {
     _target = target;
     _searchResultPackage = searchResultPackage;
     _allPackages = new List<NuGetVersion>(searchResultPackage.Versions);
     _options = new UI.Options();
     CreateActions();
 }
Exemple #4
0
 public DetailControlModel(
     InstallationTarget target,
     UiSearchResultPackage searchResultPackage)
 {
     _target = target;
     _searchResultPackage = searchResultPackage;
     _allPackages         = new List <NuGetVersion>(searchResultPackage.Versions);
     _options             = new UI.Options();
     CreateActions();
 }
 public PackageSolutionDetailControlModel(
     VsSolution solution,
     UiSearchResultPackage searchResultPackage) :
     base(solution, searchResultPackage)
 {
 }
Exemple #6
0
        public async Task <LoadResult> LoadItems(int startIndex, CancellationToken ct)
        {
            List <UiSearchResultPackage> packages = new List <UiSearchResultPackage>();
            var results = await Search(startIndex, ct);

            int resultCount = 0;

            foreach (var package in results)
            {
                ct.ThrowIfCancellationRequested();
                ++resultCount;

                var searchResultPackage = new UiSearchResultPackage(_source);
                searchResultPackage.Id      = package.Id;
                searchResultPackage.Version = package.Version;
                searchResultPackage.IconUrl = package.IconUrl;

                // get other versions
                var versionList = package.Versions.ToList();
                if (!_option.IncludePrerelease)
                {
                    // remove prerelease version if includePrelease is false
                    versionList.RemoveAll(v => v.IsPrerelease);
                }

                if (!versionList.Contains(searchResultPackage.Version))
                {
                    versionList.Add(searchResultPackage.Version);
                }

                searchResultPackage.Versions = versionList;
                searchResultPackage.Status   = PackageManagerControl.GetPackageStatus(
                    searchResultPackage.Id,
                    _target,
                    searchResultPackage.Versions);

                // filter out prerelease version when needed.
                if (searchResultPackage.Version.IsPrerelease &&
                    !_option.IncludePrerelease &&
                    searchResultPackage.Status == PackageStatus.NotInstalled)
                {
                    continue;
                }

                if (_option.Filter == Filter.UpdatesAvailable &&
                    searchResultPackage.Status != PackageStatus.UpdateAvailable)
                {
                    continue;
                }

                searchResultPackage.Summary = package.Summary;
                packages.Add(searchResultPackage);
            }

            ct.ThrowIfCancellationRequested();
            return(new LoadResult()
            {
                Items = packages,
                HasMoreItems = resultCount == _pageSize,
                NextStartIndex = startIndex + resultCount
            });
        }
 public PackageSolutionDetailControlModel(
     VsSolution solution,
     UiSearchResultPackage searchResultPackage) :
     base(solution, searchResultPackage)
 {
 }
Exemple #8
0
        public async Task<LoadResult> LoadItems(int startIndex, CancellationToken ct)
        {
            List<UiSearchResultPackage> packages = new List<UiSearchResultPackage>();
            var results = await Search(startIndex, ct);
            int resultCount = 0;
            foreach (var package in results)
            {
                ct.ThrowIfCancellationRequested();
                ++resultCount;

                var searchResultPackage = new UiSearchResultPackage(_source);
                searchResultPackage.Id = package.Id;
                searchResultPackage.Version = package.Version;
                searchResultPackage.IconUrl = package.IconUrl;

                // get other versions
                var versionList = package.Versions.ToList();
                if (!_option.IncludePrerelease)
                {
                    // remove prerelease version if includePrelease is false
                    versionList.RemoveAll(v => v.IsPrerelease);
                }

                if (!versionList.Contains(searchResultPackage.Version))
                {
                    versionList.Add(searchResultPackage.Version);
                }

                searchResultPackage.Versions = versionList;
                searchResultPackage.Status = PackageManagerControl.GetPackageStatus(
                    searchResultPackage.Id,
                    _target,
                    searchResultPackage.Versions);

                // filter out prerelease version when needed.
                if (searchResultPackage.Version.IsPrerelease &&
                   !_option.IncludePrerelease &&
                    searchResultPackage.Status == PackageStatus.NotInstalled)
                {
                    continue;
                }

                if (_option.Filter == Filter.UpdatesAvailable &&
                    searchResultPackage.Status != PackageStatus.UpdateAvailable)
                {
                    continue;
                }

                searchResultPackage.Summary = package.Summary;
                packages.Add(searchResultPackage);
            }

            ct.ThrowIfCancellationRequested();
            return new LoadResult()
            {
                Items = packages,
                HasMoreItems = resultCount == _pageSize,
                NextStartIndex = startIndex + resultCount
            };
        }