Clear() public method

public Clear ( ) : void
return void
コード例 #1
0
        void LoadUpdates()
        {
            object s = updatesTree.SaveStatus();

            updatesTree.Clear();

            AddinRepositoryEntry[] reps;
            reps = service.Repositories.GetAvailableAddins(RepositorySearchFlags.LatestVersionsOnly);

            int count = 0;

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

                // Find whatever version is installed
                Addin sinfo = AddinManager.Registry.GetAddin(Addin.GetIdName(arep.Addin.Id));
                if (sinfo == null || !sinfo.Enabled || Addin.CompareVersions(sinfo.Version, arep.Addin.Version) <= 0)
                {
                    continue;
                }

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

                AddinStatus status = AddinStatus.Installed;
                if (!sinfo.Enabled || Services.GetMissingDependencies(sinfo).Any())
                {
                    status |= AddinStatus.Disabled;
                }

                updatesTree.AddAddin(arep.Addin, arep, status | AddinStatus.HasUpdate);
                count++;
            }

            labelUpdates.Text    = string.Format(Catalog.GetPluralString("{0} update available", "{0} updates available", count), count);
            updatesTabLabel.Text = Catalog.GetString("Updates");
            if (count > 0)
            {
                updatesTabLabel.Text += " (" + count + ")";
            }

            buttonUpdateAll.Visible = count > 0;

            if (count > 0)
            {
                updatesTree.RestoreStatus(s);
            }
            else
            {
                updatesTree.ShowEmptyMessage();
            }
        }
コード例 #2
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 + ")";
            }
        }
コード例 #3
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 + ")";
            }
        }