所有方法图
SimpleScheduleBuilder方法
RepeatForever:指定触发器将无限期重复。
WithRepeatCount:指定重复次数
var trigger = TriggerBuilder.Create().WithSimpleSchedule(s=>s.WithIntervalInSeconds(1).RepeatForever()).Build();
var trigger = TriggerBuilder.Create().WithSimpleSchedule(s=>s.WithIntervalInSeconds(1)
.WithRepeatCount(10)).Build();
注:底层实现是repeatCount+1,也就是总共执行repeatCount+1次
复制代码
/// <summary>
/// Specify a the number of time the trigger will repeat - total number of
/// firings will be this number + 1.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="repeatCount">the number of seconds at which the trigger should repeat.</param>
/// <returns>the updated SimpleScheduleBuilder</returns>
/// <seealso cref="ISimpleTrigger.RepeatCount" />
/// <seealso cref="RepeatForever" />
public SimpleScheduleBuilder WithRepeatCount(int repeatCount)
{
this.repeatCount = repeatCount;
return this;
}
复制代码
WithInterval:以毫秒为单位指定重复间隔,由于是TimeSpan也可以指定时分秒
WithIntervalInHours:以小时为单位指定重复间隔
WithIntervalInMinutes:以分钟单位指定重复间隔
WithIntervalInSeconds:以秒为单位指定重复间隔
复制代码
http://www.sina.com.cn/mid/search.shtml?q=%E8%85%BE%E9%BE%99%E5%A8%B1%E4%B9%90%E5%AE%98%E7%BD%91_181-8361-5678
var trigger = TriggerBuilder.Create().WithSimpleSchedule(s=>s .WithIntervalInSeconds(1)
.WithInterval(TimeSpan.FromDays(1))
.WithIntervalInMinutes(1)
.WithIntervalInHours(1)
.WithRepeatCount(5))
.Build();
复制代码
注:底层都是通过WithInterval实现的
复制代码
/// <summary>
/// Specify a repeat interval in milliseconds.
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="timeSpan">the time span at which the trigger should repeat.</param>
/// <returns>the updated SimpleScheduleBuilder</returns>
//