Exemplo n.º 1
0
        private void Refresh(IPackage package, IPackageVersion version)
        {
            version = version ?? package?.versions.primary;
            if (version?.isFullyFetched == false)
            {
                m_PackageDatabase.FetchExtraInfo(version);
            }

            var detailVisible = package != null && version != null && !inProgressView.Refresh(package);
            var detailEnabled = version == null || version.isFullyFetched;

            if (!detailVisible)
            {
                RefreshExtensions(null, null);
            }
            else
            {
                header.Refresh(package, version);
                body.Refresh(package, version);
                toolbar.Refresh(package, version);
                RefreshExtensions(package, version);
            }

            // Set visibility
            UIUtils.SetElementDisplay(detail, detailVisible);
            UIUtils.SetElementDisplay(toolbar, detailVisible);
            UIUtils.SetElementDisplay(multiSelectDetails, false);

            SetEnabled(detailEnabled);
            RefreshDetailError(package, version);
        }
        private void RefreshContent()
        {
            if (!versionHistoryItemToggle.value)
            {
                return;
            }

            var fullyFetched = m_Version.isFullyFetched;

            UIUtils.SetElementDisplay(versionHistoryItemContainer, fullyFetched);
            if (!fullyFetched)
            {
                // If version is not fully fetched, we need to fetch extra information, meanwhile we need to start a spinner and disable the UI
                // We don't need to stop spinner since FetchExtraInfo raises a PackageVersionUpdated event,
                // and PackageDetailsVersionTabs will be refresh because PackageDetails is refreshed.
                SetEnabled(false);
                versionHistoryItemToggleSpinner.Start();
                m_PackageDatabase.FetchExtraInfo(m_Version);
                return;
            }

            RefreshReleaseDate();
            RefreshChangeLog();
            RefreshDependencies();
            RefreshMetaDataChanges();
        }