string lc_cdmc = textBox1.Text.Trim();
string lc_zxml = textBox2.Text.Trim();
XElement menu = new XElement("cdbm",
new XAttribute("cdmc", lc_cdmc),
new XAttribute("zxml", lc_zxml),
new XAttribute("sxbm", lc_sxm), lc_cdbm);
xmlFile.Add(menu);
xmlFile.Save(@"C:\XMLCdsj.xml");
string lc_xml = @"C:\XMLCdsj.xml";
Network network = new Network();
network.UploadFile(lc_xml, @"ftp://100.100.0.1/yhcd1/XMLCdsj.xml",
"administrator", "1234567", false, 500);
MessageBox.Show("菜单项添加成功 !", "系统提示", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
}
catch (Exception el)
{
MessageBox.Show("菜单项添加失败 !" + el.Message, "系统提示",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
单击按钮事件中有关 TreeView 控件修改节点及同时修改菜单项到XML树并存入XML文件代码:
private void button2_Click(object sender, EventArgs e)
{
TreeNode xdnode = treeView1.SelectedNode;
|