Пример #1
0
        private void gvAddIns_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = gvAddIns.Columns[e.ColumnIndex].Name;

            if (colName == "ColState")
            {
                AddInInfo info = gvAddIns.Rows[e.RowIndex].DataBoundItem as AddInInfo;
                if (info != null)
                {
                    if (info.IsSetup)
                    {
                        string err = info.UnInstall();
                        if (err == null)
                        {
                            MessageBox.Show("жÔØÍê±Ï", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("жÔØ´íÎó:" + err, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        string err = info.Install();
                        if (err == null)
                        {
                            MessageBox.Show("°²×°Íê±Ï", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("°²×°´íÎó:" + err, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    RefreashDisplay();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 获取插件信息
        /// </summary>
        /// <returns></returns>
        public static List <AddInInfo> GetAddInInfo()
        {
            string infoFile = _basePath + "\\AddInConfig.xml";

            if (!File.Exists(infoFile))
            {
                return(null);
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(infoFile);
            XmlNodeList      addinNodes = doc.GetElementsByTagName("AddIn");
            List <AddInInfo> lstAddIn   = new List <AddInInfo>();

            foreach (XmlNode node in addinNodes)
            {
                AddInInfo    info = new AddInInfo();
                XmlAttribute att  = node.Attributes["file"];
                if (att != null)
                {
                    info._fileName = att.InnerText;
                }
                att = node.Attributes["version"];
                if (att != null)
                {
                    info._version = att.InnerText;
                }
                att = node.Attributes["addin"];
                if (att != null)
                {
                    info._name = att.InnerText;
                }
                info._isSetup = info.IsInstall();
                lstAddIn.Add(info);
            }
            return(lstAddIn);
        }
Пример #3
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     _lstAddIns = AddInInfo.GetAddInInfo();
     gvAddIns.AutoGenerateColumns = false;
     RefreashDisplay();
 }