Beispiel #1
0
        private void PopulateInstallBtn()
        {
            ExtensionCollection collection = MpeCore.MpeInstaller.KnownExtensions.GetList(Package.GeneralInfo.Id);

            collection.Add(Package);
            foreach (PackageClass item in collection.GetList(Package.GeneralInfo.Id).Items)
            {
                ToolStripMenuItem testToolStripMenuItem = new ToolStripMenuItem();
                testToolStripMenuItem.Text = string.Format("Version - {0} [{1}]", item.GeneralInfo.Version,
                                                           item.GeneralInfo.DevelopmentStatus);
                PackageClass pak = MpeCore.MpeInstaller.InstalledExtensions.Get(Package.GeneralInfo.Id);
                if (pak != null && item.GeneralInfo.Version.CompareTo(pak.GeneralInfo.Version) == 0)
                {
                    testToolStripMenuItem.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold,
                                                          GraphicsUnit.Point, ((byte)(0)));
                }
                if (!item.CheckDependency(true))
                {
                    testToolStripMenuItem.ForeColor = Color.Red;
                }
                if (item.GeneralInfo.VersionDescription != null)
                {
                    testToolStripMenuItem.ToolTipText = item.GeneralInfo.VersionDescription.Length > 1024
                                                ? item.GeneralInfo.VersionDescription.Substring(0, 1024) + "..."
                                                : item.GeneralInfo.VersionDescription;
                }
                testToolStripMenuItem.Tag    = item;
                testToolStripMenuItem.Click += testToolStripMenuItem_Click;
                btn_install.DropDownItems.Add(testToolStripMenuItem);
            }
        }