private static void start() { try { if (Start == false) { string lpFileName = Config.lpFileName; string ip = YDS6000.Models.IniHepler.GetConfig(lpFileName, "rdc", "Ip"); int port = YDS6000.Models.CommFunc.ConvertDBNullToInt32(YDS6000.Models.IniHepler.GetConfig(lpFileName, "rdc", "DataPort")); int cnt = 0; while (cnt < 3) { ++cnt; bool rst = RdcMethod.Close(); if (rst == true) { break; } Thread.Sleep(500); } RdcMethod.RdcVar = new RdcFunc.RDC_VarOk(resultVar); //放到业务层上去 RdcMethod.Instance(ip); /*初始化*/ Start = true; } } catch (Exception ex) { FileLog.WriteLog("初始化Rdc错误:" + ex.Message + ex.StackTrace); } }
private static void start() { try { if (Start == false) { string ip = mainForm.txtIp.Text; int port = CommFunc.ConvertDBNullToInt32(mainForm.txtPort.Text); int cnt = 0; while (cnt < 3) { ++cnt; bool rst = RdcMethod.Close(); if (rst == true) { break; } Thread.Sleep(500); } RdcMethod.RdcVar = new RdcFunc.RDC_VarOk(resultVar); //放到业务层上去 RdcMethod.Instance(ip); /*初始化*/ Start = true; } } catch (Exception ex) { throw ex; } }
private void start() { try { if (Start == false) { //string lpFileName = Config.lpFileName; int cnt = 0; rdc = new RdcMethod(this.ip, this.dataPort); while (cnt < 3) { ++cnt; bool rst = rdc.Close(); if (rst == true) { break; } Thread.Sleep(500); } rdc.RdcVar = new RdcFunc.RDC_VarOk(resultVar); //放到业务层上去 //rdc.Instance(ip);/*初始化*/ /*开启事件监听*/ var ed = new Thread((ThreadStart) delegate { ReadEventDo(); }); ed.IsBackground = true; ed.Start(); // Start = true; } } catch (Exception ex) { FileLog.WriteLog("初始化Rdc错误:" + ex.Message + ex.StackTrace); } }
internal static void Close() { int cnt = 0; while (cnt < 3) { ++cnt; bool rst = RdcMethod.Close(); if (rst == true) { break; } Thread.Sleep(500); } Start = false; }