示例#1
0
        public PluginInfo(PluginManagerDialog baseDialog, PluginManager baseManager, Plugin p)
        {
            InitializeComponent();
            this.baseDialog = baseDialog;
            this.baseManager = baseManager;
            lblTitle.Text = p.getName() + " - Information";
            lblName.Text += p.getName();
            try {
                lblDev.Text += p.getAuthor();
            }
            catch {
                lblDev.Text += "Not specified";
            }
            try {
                lblVersion.Text += p.getVersion();
            }
            catch {
                lblVersion.Text += "Not specified";
            }

            if (p is Updatable) {
                lblSupportsUpdates.Text = "Plugin supports automatic updates";
                Updatable u = (Updatable)p;
                lblCur.Text += u.getCurrentVersion();
                using (var wc = new WebClient()) {
                    lblLatest.Text += wc.DownloadString(u.getCheckURL());
                }
                UpdateType t = u.getUpdateType();
                if (t == UpdateType.Ask) {
                    lblType.Text += "Plugin asks before updating";
                    lblNotes.Text += "Not supported";
                    lblRestart.Text += "Not supported";
                }
                else if (t == UpdateType.Auto_Notify) {
                    lblType.Text += "Plugin updates automatically";
                    lblNotes.Text += "Yes";
                    lblRestart.Text += "No";
                }
                else if (t == UpdateType.Auto_Notify_Restart) {
                    lblType.Text += "Plugin updates automatically";
                    lblNotes.Text += "Yes";
                    lblRestart.Text += "Yes";
                }
                else if (t == UpdateType.Auto_Silent) {
                    lblType.Text += "Plugin updates automatically";
                    lblNotes.Text += "No";
                    lblRestart.Text += "No";
                }
                else if (t == UpdateType.Auto_Silent_Restart) {
                    lblType.Text += "Plugin updates automatically";
                    lblNotes.Text += "No";
                    lblRestart.Text += "Yes";
                }
            }
            else {
                lblCur.Text += "Not supported";
                lblLatest.Text += "Not supported";
                lblType.Text += "Not supported";
                lblNotes.Text += "Not supported";
                lblRestart.Text += "Not supported";
            }
        }