Esempio n. 1
0
        private void ResetVersionItems(PackageInfo displayPackage)
        {
            VersionItems.Clear();
            VersionPopup.SetEnabled(true);

            if (displayPackage == null)
            {
                return;
            }

            //
            // Get key versions -- Latest, Verified, LatestPatch, Current.
            var keyVersions = new List <PackageInfo>();

            if (package.LatestRelease != null)
            {
                keyVersions.Add(package.LatestRelease);
            }
            if (package.Current != null)
            {
                keyVersions.Add(package.Current);
            }
            if (package.Verified != null && package.Verified != package.Current)
            {
                keyVersions.Add(package.Verified);
            }
            if (package.LatestPatch != null && package.IsAfterCurrentVersion(package.LatestPatch))
            {
                keyVersions.Add(package.LatestPatch);
            }
            if (package.Current == null && package.LatestRelease == null && package.Latest != null)
            {
                keyVersions.Add(package.Latest);
            }
            if (Package.ShouldProposeLatestVersions && package.Latest != package.LatestRelease && package.Latest != null)
            {
                keyVersions.Add(package.Latest);
            }
            keyVersions.Add(package.LatestUpdate);        // Make sure LatestUpdate is always in the list.

            foreach (var version in keyVersions.OrderBy(package => package.Version).Reverse())
            {
                var item = new VersionItem {
                    Version = version
                };
                VersionItems.Add(item);

                if (version == package.LatestUpdate)
                {
                    VersionPopup.value = item;
                }
            }

            //
            // Add all versions
            foreach (var version in package.Versions.Reverse())
            {
                var item = new VersionItem {
                    Version = version
                };
                item.MenuName = "All Versions/";
                VersionItems.Add(item);
            }

            if (VersionItems.Count == 0)
            {
                VersionItems.Add(EmptyVersion);
                VersionPopup.value = EmptyVersion;
                VersionPopup.SetEnabled(false);
            }
        }
Esempio n. 2
0
 private string VersionSelectionSetLabel(VersionItem item)
 {
     return(item.Label);
 }