public void Close()
{
_initializing = false;
_delayedEnable = false;
_enabled = false;
if (_timer != null)
{
_timer.Dispose();
_timer = null;
}
}
/// <summary> /// 清除定时器 /// </summary> public void ClearTimer() { try { _timer.Elapsed -= Checklive; _timer.Stop(); _timer.Close(); _timer.Dispose(); } catch { Thread.Sleep(1000 * 3);//休息3秒再清除定时器 try { _timer.Elapsed -= Checklive; _timer.Stop(); _timer.Close(); _timer.Dispose(); } catch (Exception ex) { LogManager.DefaultLogger.DebugFormat("ClearTimer Error:{0}", new { _imuserid, _channelid, _sourcetype, err = ex.ToString() }.ToJson()); } } }