示例#1
0
        /// <summary>
        /// Initializes a new instance of the EditorPane class.
        /// </summary>
        public PackageManagerWindowPane(PackageManagerModel myDoc, IUserInterfaceService ui)
            : base(null)
        {
            PackageManagerControl control = new PackageManagerControl(myDoc, ui);

            _content = control;
        }
        internal void UpdatePackageStatus()
        {
            if (ShowInstalled || ShowUpdatesAvailable)
            {
                // refresh the whole package list
                _packageList.Reload();
            }
            else
            {
                // in this case, we only need to update PackageStatus of
                // existing items in the package list
                foreach (var item in _packageList.Items)
                {
                    var package = item as UiSearchResultPackage;
                    if (package == null)
                    {
                        continue;
                    }

                    package.Status = PackageManagerControl.GetPackageStatus(
                        package.Id,
                        Target,
                        package.Versions);
                }
            }
        }
 private void CleanUp()
 {
     if (_content != null)
     {
         _content.CleanUp();
         _content = null;
     }
 }
示例#4
0
 private void CleanUp()
 {
     if (_content != null)
     {
         _content.CleanUp();
         _content = null;
     }
 }
 /// <summary>
 /// Initializes a new instance of the EditorPane class.
 /// </summary>
 public PackageManagerWindowPane(PackageManagerModel myDoc, IUserInterfaceService ui)
     : base(null)
 {
     PackageManagerControl control = new PackageManagerControl(myDoc, ui);
     _content = control;
 }
示例#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
            });
        }