/// <summary> /// 守护服务加载 /// </summary> private static void RobotByServLoad() { if ((Common.DtServInfo.Columns["ID"] == null) || (Common.DtServInfo.Columns["TYPE"] == null) || (Common.DtServInfo.Columns["ServName"] == null) || (Common.DtServInfo.Columns["ServPath"] == null) || (Common.DtServInfo.Columns["APPTYPE"] == null)) { return; } for (int i = 0; i < Common.DtServInfo.Rows.Count; i++) { RobotByServMonitor RbSm = new RobotByServMonitor(); RbSm.Interval = 3000; RbSm.ServName = Common.DtServInfo.Rows[i]["ServName"].ToString(); RbSm.ServPath = Common.DtServInfo.Rows[i]["ServPath"].ToString(); RbSm.APPTYPE = Common.DtServInfo.Rows[i]["APPTYPE"].ToString(); if (Common.DtServInfo.Rows[i]["ID"] != null) { RbSm.ID = Common.DtServInfo.Rows[i]["ID"].ToString(); } if (Common.DtServInfo.Rows[i]["TYPE"] != null) { RbSm.TYPE = Common.DtServInfo.Rows[i]["TYPE"].ToString(); } ThreadPool.QueueUserWorkItem(new WaitCallback(RobotByServStart), RbSm); } }
/// <summary> /// 守护服务启动 /// </summary> /// <param name="obj">启动对像</param> private static void RobotByServStart(object obj) { RobotByServMonitor RbSm = (RobotByServMonitor)obj; RbSm.Start(); }