public void main_Load(object sender, EventArgs e)
{
string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";
XmlDocument docx = new XmlDocument();
docx.Load(xmlpath);
XmlElement root = docx.DocumentElement;
XmlElement checkcount = (XmlElement)root.GetElementsByTagName("checkcount")[0];
// XmlNodeList xnlist = docx.SelectNodes("Mjdesign/checked/id");
XmlNodeList xmlist = docx.SelectNodes("Mjdesign/unchecked/id");
// string chstr = "";
string unchstr = "";
//if (xnlist!=null)
//{
// foreach (XmlNode mnode in xnlist)
// {
// chstr =chstr+ mnode.InnerText + "-";
// }
//}
//label2.Text = chstr;
if (xmlist!=null)
{
foreach (XmlNode mnode in xmlist)
{
unchstr = unchstr + mnode.InnerText + "-";
}
}
label1.Text = unchstr;
// XmlElement pwd = (XmlElement)root.GetElementsByTagName("pwd")[0];
// string checkstr = checkcount.InnerText.ToString();
//groupBox3.Text = "共已抽出" + checkstr + "个数";
// 获取当前单位信息
string uppath = System.AppDomain.CurrentDomain.BaseDirectory;
uppath = uppath.Substring(0, uppath.Length - 1);
int clen = uppath.LastIndexOf("\\");
uppath = uppath.Substring(0, clen);
uppath = uppath + "\\setting.xml";
XmlDocument xdoc = new XmlDocument();
xdoc.Load(uppath);
XmlElement xroot = xdoc.DocumentElement;
XmlNodeList nlist = xdoc.SelectNodes("Mjdesign/company");
if (nlist != null)
{
foreach (XmlNode msnode in nlist)
{
XmlNodeList mlist = msnode.ChildNodes;
foreach (XmlNode nsnode in mlist)
{
// MessageBox.Show(nsnode.Name);
if (nsnode.Name == "cname")
{
XmlElement xe = (XmlElement)nsnode;
dwxxstr.Text = xe.InnerText;
//MessageBox.Show(dwmc.Text);
}
if (nsnode.Name == "pname")
{
XmlElement xe = (XmlElement)nsnode;
cqrstr.Text = xe.InnerText;
}
if (nsnode.Name == "phnum")
{
XmlElement xe = (XmlElement)nsnode;
dhstr.Text = xe.InnerText;
}
if (nsnode.Name == "idnum")
{
XmlElement xe = (XmlElement)nsnode;
sfzstr.Text = xe.InnerText;
}
if (nsnode.Name == "proname")
{
XmlElement xe = (XmlElement)nsnode;
xmmcstr.Text = xe.InnerText;
}
}
}
}
XmlElement cname = (XmlElement)xroot.GetElementsByTagName("cname")[0];
XmlElement pname = (XmlElement)xroot.GetElementsByTagName("pname")[0];
XmlElement phnum = (XmlElement)xroot.GetElementsByTagName("phnum")[0];
XmlElement idnum = (XmlElement)xroot.GetElementsByTagName("idnum")[0];
XmlElement proname = (XmlElement)xroot.GetElementsByTagName("proname")[0];
// dqxx.Text ="当前单位信息:"+ cname.InnerText+" "+pname.InnerText+" "+phnum.InnerText+" "+idnum.InnerText;
dwxxstr.Text = cname.InnerText;
xmmcstr.Text = proname.InnerText;
cqrstr.Text = pname.InnerText;
dhstr.Text = phnum.InnerText;
sfzstr.Text = idnum.InnerText;
}