private void From_Seeting_eCATPath_Load(object sender, EventArgs e) { //1.当前路径,不知为何,在XP上,如果在当前窗体选择了文件后,使用system.Enviroment获取路径会有差异。所以用这个方法 //由一个A进程启动B进程,在B进程中使用system.Enviroment获取路径会得到A进程的当前路径。 string processName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; currentProcessPath = processName.Substring(0, processName.LastIndexOf('\\')); //2.获取eCAT路径列表 string resultXML_eCAT = XMLHelper.instance.XMLFiles["BaseConfig"].GetXmlAttributeValue("BaseConfig.Settings.eCATPath.[*].{*}"); if (!string.IsNullOrEmpty(resultXML_eCAT)) { List <string> eCATPathList = XDCUnity.GetXmlValueList(resultXML_eCAT); cmb_eCAT.DataSource = eCATPathList; } string resultXML_TrueBack = XMLHelper.instance.XMLFiles["BaseConfig"].GetXmlAttributeValue("BaseConfig.Settings.TrueBackPath.[*].{*}"); if (!string.IsNullOrEmpty(resultXML_TrueBack)) { List <string> trueBackPathList = XDCUnity.GetXmlValueList(resultXML_TrueBack); cmb_Trueback.DataSource = trueBackPathList; } //3.获取当前默认的eCAT路径 XmlDocument doc = XMLHelper.instance.XMLFiles["BaseConfig"].XmlDoc; XmlNode eCATnode = doc.SelectSingleNode("BaseConfig/Settings/eCATPath"); XmlNode trueBacknode = doc.SelectSingleNode("BaseConfig/Settings/TrueBackPath"); //默认选中eCAT string currenteCATPath = eCATnode.Attributes["value"].InnerText; if (cmb_eCAT.Items.Contains(currenteCATPath)) { cmb_eCAT.Text = currenteCATPath; } //默认选中TrueBack string currentTruebackPath = trueBacknode.Attributes["value"].InnerText; if (cmb_Trueback.Items.Contains(currentTruebackPath)) { cmb_Trueback.Text = currentTruebackPath; } //编码 add by frde 20160628 XmlNode formatCode = doc.SelectSingleNode("BaseConfig/Settings/FormatCode"); string currentCode = formatCode.Attributes["value"].InnerText; switch (currentCode.ToUpper()) { case "ASCII": { rbt_ASCII.Checked = true; } break; case "EBCD": { rbt_EBCD.Checked = true; } break; default: break; } XDCUnity.CurrentFormatCode = currentCode; currentFormatCodenode = formatCode; }