private UpdatePackageEntry GetOrAddEntry(Dictionary <string, UpdatePackageEntry> list, string packageId) { UpdatePackageEntry entry; if (!list.TryGetValue(packageId, out entry)) { entry = new UpdatePackageEntry { PackageVersions = new List <PackagingEntry>() }; list.Add(packageId, entry); } return(entry); }
public IEnumerable <string> Displaying(ExtensionDescriptor extensionDescriptor, RequestContext requestContext) { // Get status from background task state or directly _backgroundPackageUpdateStatus.Value = _backgroundPackageUpdateStatus.Value ?? _packageUpdateService.GetPackagesStatus(_packagingSourceManager.GetSources()); UpdatePackageEntry updatePackageEntry = _backgroundPackageUpdateStatus.Value.Entries .Where(package => package.ExtensionsDescriptor.Id.Equals(extensionDescriptor.Id)).FirstOrDefault(); if (updatePackageEntry != null) { if (updatePackageEntry.NewVersionToInstall != null) { UrlHelper urlHelper = new UrlHelper(requestContext); yield return(T("Version {0} is available (See <a href=\"{1}\">Updates</a>).", updatePackageEntry.NewVersionToInstall.Version, urlHelper.Action(DefaultExtensionTypes.IsTheme(updatePackageEntry.ExtensionsDescriptor.ExtensionType) ? "ThemesUpdates" : "ModulesUpdates", "GalleryUpdates")).ToString()); } } }