using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SKMC.Api.Common.Monitor
{
///
/// 检测器基类
///
public class BaseMonitor : IDisposable
{
public Timer timer;
///
/// 轮询周期 ms
///
public int CT { get; set; } = 100;
///
/// 是否运行中
///
public bool IsRunning { get; set; }
///
/// 启动监测
///
public void Start()
{
if (!IsRunning)
{
timer.Change(0, CT);
IsRunning = true;
}
}
///
/// 停止监测
///
public void Stop()
{
IsRunning = false;
}
///
/// 关闭监测
///
public void Dispose()
{
timer.Dispose();
}
}
}