首页 > 其他分享 >Random 项目总结 -04设置项目项目写入XML,,调用exe

Random 项目总结 -04设置项目项目写入XML,,调用exe

时间:2024-04-20 21:46:10浏览次数:27  
标签:XML xdoc 04 项目 pro nsnode XmlElement StartInfo true

 

Process pro = new Process();
string propath = System.AppDomain.CurrentDomain.BaseDirectory;
string t_data = "";
string t_sa = "";
string t_pwd = "";

private void button1_Click(object sender, EventArgs e)
{

//

// 写入 xml

string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml";

XmlDocument xdoc = new XmlDocument();
xdoc.Load(xmlpath);
XmlElement root = xdoc.DocumentElement;

//* ***创建节点****
//XmlElement company = xdoc.CreateElement("company");
//root.AppendChild(company);
//XmlElement cid = xdoc.CreateElement("cid");
//XmlElement xcname = xdoc.CreateElement("cname");
//XmlElement xpname = xdoc.CreateElement("pname");
//XmlElement xphnum = xdoc.CreateElement("phnum");
//XmlElement xidnum = xdoc.CreateElement("idnum");
//xcname.InnerText = dwmc.Text.ToString();
//xpname.InnerText = pname.Text;
//xphnum.InnerText = pname.Text;
//xidnum.InnerText = textBox4.Text;
//company.AppendChild(cid);
//company.AppendChild(xcname);
//company.AppendChild(xpname);
//company.AppendChild(xphnum);
//company.AppendChild(xidnum);
//*****

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;

xe.InnerText = dwmc.Text;
xdoc.Save(xmlpath);
//MessageBox.Show(dwmc.Text);
}

if (nsnode.Name == "pname")
{
XmlElement xe = (XmlElement)nsnode;

xe.InnerText = pname.Text;
xdoc.Save(xmlpath);

}
if (nsnode.Name == "phnum")
{
XmlElement xe = (XmlElement)nsnode;

xe.InnerText = phnum.Text;

xdoc.Save(xmlpath);
}

if (nsnode.Name == "idnum")
{
XmlElement xe = (XmlElement)nsnode;

xe.InnerText = pnum.Text;
xdoc.Save(xmlpath);

}
if (nsnode.Name == "proname")
{
XmlElement xe = (XmlElement)nsnode;

xe.InnerText = xmmc.Text;
xdoc.Save(xmlpath);

}

}
}


}


if (radioButton1.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R1";
pro.StartInfo.FileName = "R1.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}
if (radioButton2.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R2";
pro.StartInfo.FileName = "R2.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}
if (radioButton3.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R3";
pro.StartInfo.FileName = "R3.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}
if (radioButton4.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R4";
pro.StartInfo.FileName = "R4.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}


if (radioButton5.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R5";
pro.StartInfo.FileName = "R5.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}
if (radioButton6.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R6";
pro.StartInfo.FileName = "R6.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}
if (radioButton7.Checked == true)
{
pro.StartInfo.WorkingDirectory = propath + "R7";
pro.StartInfo.FileName = "R7.exe";
pro.StartInfo.UseShellExecute = true;

pro.Start();
this.FindForm().Close();
}

 

}

标签:XML,xdoc,04,项目,pro,nsnode,XmlElement,StartInfo,true
From: https://www.cnblogs.com/lionmxs/p/18148216

相关文章

  • 读取XML 信息
    publicvoidmain_Load(objectsender,EventArgse){stringxmlpath=System.AppDomain.CurrentDomain.BaseDirectory+"setting.xml";XmlDocumentdocx=newXmlDocument();docx.Load(xmlpath);Xml......
  • 2024-04-20 闲话
    最近读到了这么一首诗,最后一句写得很有意境。酬乐天咏老见示人谁不顾老,老去有谁怜。身瘦带频减,发稀冠自偏。废书缘惜眼,多炙为随年。经事还谙事,阅人如阅川。细思皆幸矣,下此便翛然。莫道桑榆晚,为霞尚满天。总有人说老了老了,水平不行了。其实这样的人实力都是非常强劲的。......
  • Computer Basics 04 - Buttons and Ports on a Computer
     IntroductionTakealookatthefrontandbackofyourcomputercaseandcountthenumberofbuttons,ports,andslotsyousee.Nowlookatyourmonitorandcountanyyoufindthere.Youprobablycountedatleast10,andmaybealotmore.Eachcomputer......
  • Random 项目总结 -03测试链接按钮 测试数据链接
    注意:如果填写地址是指定端口IP地址与端口之间需要用逗号隔开。 privatevoidbutton2_Click(objectsender,EventArgse){stringstrdata=textBox1.Text;stringstrsa=textBox2.Text;stringstrpwd=textBox3.Text;......
  • Random 项目总结 -登录按钮 读取XML文件判断用户、密码是否正确
      一、登录按钮privatevoidbutton1_Click(objectsender,EventArgse){stringxmlpath=System.AppDomain.CurrentDomain.BaseDirectory+"setting.xml";XmlDocumentdocx=newXmlDocument();docx.Load(xmlpath);......
  • Random 项目总结 -设置按钮 设置数据库地址, 用户密码写入XML
    privatevoidbutton1_Click(objectsender,EventArgse){stringxmlpath=System.AppDomain.CurrentDomain.BaseDirectory+"setting.xml";XmlDocumentxmldoc=newXmlDocument();xmldoc.Load(xmlpath);......
  • PS1045L-ASEMI超低Low VF肖特基PS1045L
    编辑:llPS1045L-ASEMI超低LowVF肖特基PS1045L型号:PS1045L品牌:ASEMI封装:TO-227最大平均正向电流(IF):10A最大循环峰值反向电压(VRRM):45V最大正向电压(VF):0.44V~0.47V工作温度:-40°C~150°C反向恢复时间:5ns芯片个数:1芯片尺寸:62mil引脚数量:2正向浪涌电流(IFMS):200A包装方式:50/管......
  • MBR1040FCT-ASEMI超低VF值肖特基MBR1040FCT
    编辑:llMBR1040FCT-ASEMI超低VF值肖特基MBR1040FCT型号:MBR1040FCT品牌:ASEMI封装:TO-220F最大平均正向电流(IF):10A最大循环峰值反向电压(VRRM):40V最大正向电压(VF):0.54V~0.70V工作温度:-65°C~175°C反向恢复时间:5ns芯片个数:2芯片尺寸:74mil正向浪涌电流(IFMS):150AMBR1040FCT特性:......
  • 20240420【提高】模拟
    T1只过了这个。模拟样例,将所有\([i,j]\)列成一个表格后能很明显找到规律,然后实现的话不好说,看代码。点击查看代码#include<bits/stdc++.h>usingnamespacestd;#definelllonglongconstllN=5*1145140,M=1919810,mod=998244353;intn,a[N],s13[N],s31[N];//AC和CA的......
  • 代码源月赛 202404
    Link。赛时情况AK了,题目相当简单。最后居然rk23。赛后总结E题调了相当久,很不仔细,犯了很多低级错误。太不牛了。题解Alink。直接打印。aclink。B......