/// <summary> /// Add the specified message, beginTime, endTime, isCycle and secondInterval. /// </summary> /// <param name="message">Message.</param> /// <param name="beginTime">Begin time.</param> /// <param name="endTime">End time.</param> /// <param name="isCycle">If set to <c>true</c> is cycle.</param> /// <param name="secondInterval">Second interval.</param> public void Add(NoticeMessage message, string beginTime, string endTime, bool isCycle, int secondInterval) { PlanConfig planConfig = null; if (isCycle) { planConfig = PlanConfig.EveryMinutePlan(DoBroadcast, "BroadcastTimer", beginTime, endTime, secondInterval); } else { planConfig = PlanConfig.OncePlan(DoBroadcast, "BroadcastTimer", beginTime); } planConfig.Target = message; TimeListener.Append(planConfig); }
/// <summary> /// 发送消息 /// </summary> /// <param name="message"></param> public void Send(NoticeMessage message) { if (message == null || string.IsNullOrEmpty(message.Content)) { throw new ArgumentNullException("message", "message or message's Content is empty."); } _cacheSet.Send(message); WriteLog(message); }
/// <summary> /// 写日志 /// </summary> /// <param name="message"></param> protected virtual void WriteLog(NoticeMessage message) { }
/// <summary> /// 是否可以接收 /// </summary> /// <param name="versionId"></param> /// <param name="message"></param> /// <returns></returns> protected virtual bool HasReceive(int versionId, NoticeMessage message) { if (message.VersionId > versionId) { SetVersionId(message.VersionId); return true; } return false; }
/// <summary> /// Timers the callback. /// </summary> /// <param name="message">Message.</param> protected void TimerCallback(NoticeMessage message) { Send(Create(message.NoticeType, message.Content, message.Title, message.ExpiryDate)); }
/// <summary> /// 定时发送 /// </summary> /// <param name="message"></param> /// <param name="week">按每周几发送</param> /// <param name="beginTime"></param> /// <param name="endTime"></param> /// <param name="isCycle"></param> /// <param name="secondInterval"></param> public void SendTimer(NoticeMessage message, DayOfWeek week, string beginTime, string endTime, bool isCycle, int secondInterval) { _timer.Add(message, week, beginTime, endTime, isCycle, secondInterval); }
/// <summary> /// Add the specified message, week, beginTime, endTime, isCycle and secondInterval. /// </summary> /// <param name="message">Message.</param> /// <param name="week">Week.</param> /// <param name="beginTime">Begin time.</param> /// <param name="endTime">End time. void</param> /// <param name="isCycle">If set to <c>true</c> is cycle. void</param> /// <param name="secondInterval">Second interval. void</param> public void Add(NoticeMessage message, DayOfWeek week, string beginTime, string endTime, bool isCycle, int secondInterval) { var planConfig = PlanConfig.EveryWeekPlan(DoBroadcast, "BroadcastTimer", week, beginTime); planConfig.Target = message; TimeListener.Append(planConfig); }
public void Add(NoticeMessage message, DayOfWeek week, string beginTime, string endTime, bool isCycle, int secondInterval) { TimeListener.Append(new PlanConfig(DoBroadcast, week, beginTime, endTime, isCycle, secondInterval) { Name = "BroadcastTimer", Target = message }); }
protected void TimerCallback(NoticeMessage message) { Send(Create(message.NoticeType, message.Content, message.Title, message.ExpiryDate)); }
/// <summary> /// 定时发送 /// </summary> /// <param name="message"></param> /// <param name="week">按每周几发送</param> /// <param name="beginTime"></param> /// <param name="endTime"></param> /// <param name="isCycle"></param> /// <param name="secondInterval"></param> public void SendTimer(NoticeMessage message, DayOfWeek week, string beginTime, string endTime, bool isCycle, int secondInterval) { _timer.Add(message, week, beginTime, endTime, isCycle, secondInterval); }
/// <summary> /// 写日志 /// </summary> /// <param name="message"></param> protected virtual void WriteLog(NoticeMessage message) { }