RestoreStatus() public method

public RestoreStatus ( object ob ) : void
ob object
return void
コード例 #1
0
        void LoadInstalled()
        {
            object s = tree.SaveStatus();

            int count = 0;

            tree.Clear();
            foreach (Addin ainfo in AddinManager.Registry.GetModules(AddinSearchFlags.IncludeAddins | AddinSearchFlags.LatestVersionsOnly))
            {
                if (Services.InApplicationNamespace(service, ainfo.Id) && !ainfo.Description.IsHidden)
                {
                    AddinHeader ah = SetupService.GetAddinHeader(ainfo);
                    if (IsFiltered(ah))
                    {
                        continue;
                    }
                    AddinStatus st = AddinStatus.Installed;
                    if (!ainfo.Enabled || Services.GetMissingDependencies(ainfo).Any())
                    {
                        st |= AddinStatus.Disabled;
                    }
                    if (addininfoInstalled.GetUpdate(ainfo) != null)
                    {
                        st |= AddinStatus.HasUpdate;
                    }
                    tree.AddAddin(ah, ainfo, st);
                    count++;
                }
            }

            if (count > 0)
            {
                tree.RestoreStatus(s);
            }
            else
            {
                tree.ShowEmptyMessage();
            }

            UpdateAddinInfo();

            installedTabLabel.Text = Catalog.GetString("Installed");

            if (filterEntry.Text.Length != 0 && count > 0)
            {
                installedTabLabel.Text += " (" + count + ")";
            }
        }
コード例 #2
0
        void LoadGallery()
        {
            object s = galleryTree.SaveStatus();

            galleryTree.Clear();

            string rep = GetRepoSelection();

            AddinRepositoryEntry[] reps;
            if (rep == AllRepoMarker)
            {
                reps = service.Repositories.GetAvailableAddins(RepositorySearchFlags.LatestVersionsOnly);
            }
            else
            {
                reps = service.Repositories.GetAvailableAddins(rep, RepositorySearchFlags.LatestVersionsOnly);
            }

            int count = 0;

            foreach (AddinRepositoryEntry arep in reps)
            {
                if (!Services.InApplicationNamespace(service, arep.Addin.Id))
                {
                    continue;
                }

                if (IsFiltered(arep.Addin))
                {
                    continue;
                }

                AddinStatus status = AddinStatus.NotInstalled;

                // Find whatever version is installed
                Addin sinfo = AddinManager.Registry.GetAddin(Addin.GetIdName(arep.Addin.Id));

                if (sinfo != null)
                {
                    status |= AddinStatus.Installed;
                    if (!sinfo.Enabled || Services.GetMissingDependencies(sinfo).Any())
                    {
                        status |= AddinStatus.Disabled;
                    }
                    if (Addin.CompareVersions(sinfo.Version, arep.Addin.Version) > 0)
                    {
                        status |= AddinStatus.HasUpdate;
                    }
                }
                galleryTree.AddAddin(arep.Addin, arep, status);
                count++;
            }

            if (count > 0)
            {
                galleryTree.RestoreStatus(s);
            }
            else
            {
                galleryTree.ShowEmptyMessage();
            }

            galleryTabLabel.Text = Catalog.GetString("Gallery");

            if (filterEntry.Text.Length != 0 && count > 0)
            {
                galleryTabLabel.Text += " (" + count + ")";
            }
        }