private void initport() { WorkingSets.local.Tz3310 = new ClassTz3310(); string comconfig = XmlConfig.GetAddNodeValue("Comport"); if (comconfig == "auto") { string pn = WorkingSets.local.Tz3310.AutoConnectMe; if (pn != null) { if (!WorkingSets.local.Tz3310.OpenPort(pn, 115200, 8, 1)) { Thread.Sleep(500); try { WorkingSets.local.MethonID = WorkingSets.local.Tz3310.ReadMethonId(); } catch { MessageBox.Show("读取仪器编号失败"); } if (WorkingSets.local.MethonID == null) { WorkingSets.local.MethonID = "370001"; } } else { byhand(); } } else { byhand(); } } else { try { if (XmlConfig.GetAddNodeValue("Check") != "False") { if (true == WorkingSets.local.Tz3310.OpenPort(comconfig, 115200, 8, 1)) { if (!WorkingSets.local.Tz3310.CommunicationQuery(1)) { byhand(); } } else { byhand(); } } } catch { byhand(); } } }