/// <summary> /// 增加每毫秒处理 /// </summary> /// <param name="eHandle"></param> /// <returns></returns> private int AddMillisecond(EveryHandle eHandle, int t) { //Timer.CreateTimer(); if (eHandle == null) { return(-1); } int tId = GetTimeId(); everyMillisecondHandles.Add(tId, new EveryHandleData(eHandle, t)); return(tId); }
/// <summary> /// 增加每分钟处理 /// </summary> /// <param name="eHandle"></param> /// <returns></returns> private int AddMinute(EveryHandle eHandle, int t) { //Timer.CreateTimer(); if (eHandle == null) { return(-1); } int tId = GetTimeId(); if (everyMinuteHandles.Count == 0) { lastMinute = GetNowTime() / 1000; } everyMinuteHandles.Add(tId, new EveryHandleData(eHandle, t)); return(tId); }
/// <summary> /// 增加deadLine时间处理 /// </summary> /// <param name="eHandle"></param> /// <param name="cHandle"></param> /// <returns></returns> private int AddDeadLine(double deadLine, CompleteHandler cHandle, EveryHandle eHandle = null) { //Timer.CreateTimer(); if (cHandle == null) { return(-1); } double nt = GetNowTime(); int tId = GetTimeId(); completeHandles.Add(tId, cHandle); completeTimes.Add(tId, deadLine); if (eHandle != null) { everySecondHandles.Add(tId, new EveryHandleData(eHandle)); } return(tId); }
/// <summary> /// 增加倒计时处理2 /// </summary> /// <param name="sec">单位毫秒</param> /// <param name="eHandle">每毫秒处理</param> /// <param name="cHandle">完成处理</param> /// <returns></returns> private int AddCoundDown2(int sec, CompleteHandler cHandle, EveryHandle eHandle = null) { //Timer.CreateTimer(); if (cHandle == null) { return(-1); } int tId = GetTimeId(); completeHandles.Add(tId, cHandle); double deadLine = GetNowTime() + sec; completeTimes.Add(tId, deadLine); if (eHandle != null) { everyMillisecondHandles.Add(tId, new EveryHandleData(eHandle)); } return(tId); }
/// <summary> /// 设置每分钟 /// </summary> /// <param name="eHandle">每分钟处理</param> /// <returns></returns> public int SetEveryMinute(EveryHandle eHandle, int t = 1) { return(AddMinute(eHandle, t)); }
/// <summary> /// 设置每秒处理 /// </summary> /// <param name="eHandle">每秒处理</param> /// <returns></returns> public int SetEverySecond(EveryHandle eHandle, int t = 1) { return(AddSecond(eHandle, t)); }
/// <summary> /// 设置每毫秒秒处理 /// </summary> /// <param name="eHandle">每秒处理</param> /// <returns></returns> public int SetEveryMilliSecond(EveryHandle eHandle, int t = 1) { return(AddMillisecond(eHandle, t));//.AddSecond(eHandle, t); }
/// <summary> /// 设置倒计时处理2,传入毫秒 /// </summary> /// <param name="sec">倒计时毫秒数</param> /// <param name="cHandle">完成处理</param> /// <param name="eHandle">每毫秒处理</param> /// <returns></returns> public int SetCountDownByMillisecond(int sec, CompleteHandler cHandle, EveryHandle eHandle = null) { return(AddCoundDown2(sec, cHandle, eHandle)); }
public int SetDeadLineMs(double deadLine, CompleteHandler cHandle, EveryHandle eHandle = null) { return(AddDeadLine(deadLine, cHandle, eHandle)); }
public int SetDeadLineStr(string deadLine, CompleteHandler cHandle, EveryHandle eHandle = null) { return(AddDeadLineStr(deadLine, cHandle, eHandle)); }
/// <summary> /// 设置deadLine时间处理 /// </summary> /// <param name="deadLine">最终时间</param> /// <param name="cHandle">完成处理</param> /// <param name="eHandle">每秒处理</param> /// <returns></returns> public int SetDeadLine(int deadLine, CompleteHandler cHandle, EveryHandle eHandle = null) { return(AddDeadLine(deadLine * 1000, cHandle, eHandle)); }