public static void Start() { lstNQ = new List <M_MT_TagDefine>(); lstPLC = new List <M_MT_TagDefine>(); #region 初始化数据链接 try { sqlConnection_Main = new SqlConnection(strCon); sqlConnection_Main.Open(); } catch (Exception ex) { } try { sqlConnection_Main2 = new SqlConnection(strCon); sqlConnection_Main2.Open(); } catch (Exception ex) { } try { mySqlConnection = new MySqlConnection(strConMySql); mySqlConnection.Open(); } catch { } Thread.Sleep(1000); #endregion CheckAndUpdateConfig(); //初始化配置文件检查线程 timerCheck = new Timer(CheckPeriod); timerCheck.Elapsed += timerCheck_Elapsed; timerCheck.Start(); //初始化日志线程 timerLog = new Timer(LogPeriod); timerLog.Elapsed += timerLog_Elapsed; timerLog.Start(); }
/// <summary> /// 启动函数 /// </summary> public void Start() { fSmsBaseClass = new SmsBaseClass(); try { fSmsBaseClass.OpenPort(ComPort); } catch (Exception e) { var msg = string.Format("{0} {1} {2}", DateTime.Now.ToString(BasePublic.strTimeFormat), ComPort + "串口打开失败!", e.Message); Console.WriteLine(string.Format(msg)); BasePublic.ExceptionDeal(BaseEnum.Msg, msg); } timerSend = new Timer(SendSmsPeriod); timerSend.Elapsed += TimerSend_Elapsed; timerSend.Start(); }
/// <summary> /// 启动函数 /// </summary> public void Start() { timerSend = new Timer(SendSmsPeriod); timerSend.Elapsed += TimerSend_Elapsed; timerSend.Start(); }