Exemple #1
0
        //将菜单设置为启动项
        private void btnSetstartitem_Click(object sender, EventArgs e)
        {
            //FrmDevSetting setting = new FrmDevSetting();
            //setting.ShowDialog();

            if (gridpluginmenu.CurrentCell == null)
            {
                return;
            }
            if (treePlugin.SelectedNode == null || treePlugin.SelectedNode.Tag == null)
            {
                return;
            }
            PluginClass pc = (PluginClass)treePlugin.SelectedNode.Tag;

            List <menuClass> mlist = gridpluginmenu.DataSource as List <menuClass>;
            menuClass        menu  = mlist[gridpluginmenu.CurrentCell.RowIndex];

            if (pc.plugintype == "WebModulePlugin")
            {
                string      netwebserver     = CommonHelper.AppRootPath + "\\NetWebServer.exe.config";
                XmlDocument xmlDoc_webserver = new System.Xml.XmlDocument();
                xmlDoc_webserver.Load(netwebserver);
                XmlNode node = xmlDoc_webserver.DocumentElement.SelectSingleNode("appSettings/add[@key='defaultpage']");
                node.Attributes["value"].Value = menu.menupath;
                xmlDoc_webserver.Save(netwebserver);
            }
            else if (pc.plugintype == "WinformModulePlugin")
            {
                string      pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                string      appconfig     = CommonHelper.WinformPlatformPath + "\\EFWWin.exe.config";
                XmlDocument xmlDoc_app    = new System.Xml.XmlDocument();
                xmlDoc_app.Load(appconfig);
                PluginSysManage.pluginsysFile = pluginsysFile;
                XmlNode node = xmlDoc_app.DocumentElement.SelectSingleNode("appSettings/add[@key='ClientType']");
                node.Attributes["value"].Value = "Winform";
                xmlDoc_app.Save(appconfig);
                PluginSysManage.SetWinformEntry(menu.pluginname, menu.viewname == "" ? menu.controllername : menu.controllername + "|" + menu.viewname);
            }
            else if (pc.plugintype == "WcfModulePlugin")
            {
                string      pluginsysFile = CommonHelper.WinformPlatformPath + "\\Config\\pluginsys.xml";
                string      appconfig     = CommonHelper.WinformPlatformPath + "\\EFWWin.exe.config";
                XmlDocument xmlDoc_app    = new System.Xml.XmlDocument();
                xmlDoc_app.Load(appconfig);
                PluginSysManage.pluginsysFile = pluginsysFile;
                XmlNode node = xmlDoc_app.DocumentElement.SelectSingleNode("appSettings/add[@key='ClientType']");
                node.Attributes["value"].Value = "WCFClient";
                xmlDoc_app.Save(appconfig);
                PluginSysManage.SetWcfClientEntry(menu.pluginname, menu.viewname == "" ? menu.controllername : menu.controllername + "|" + menu.viewname);
            }

            MessageBoxEx.Show("设置启动项成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            XmlNode node = xmlDoc_app.DocumentElement.SelectSingleNode("appSettings/add[@key='ClientType']");

            if (rbwinform.Checked)
            {
                node.Attributes["value"].Value = "Winform";
                PluginSysManage.SetWinformEntry(cbpname.Text, txtcname.Text);
            }
            else if (rbwcfclient.Checked)
            {
                node.Attributes["value"].Value = "WCFClient";
                PluginSysManage.SetWcfClientEntry(cbpname.Text, txtcname.Text);
            }

            node = xmlDoc_app.DocumentElement.SelectSingleNode("appSettings/add[@key='WCF_endpoint']");
            node.Attributes["value"].Value = txtwcfendpoint.Text;

            xmlDoc_app.Save(appconfig);

            MessageBoxEx.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }