예제 #1
0
 /// <summary>
 ///     Runs the specified ticker delegate periodically.
 /// </summary>
 /// <param name="tickerDelegate">The ticker delegate.</param>
 /// <param name="timeSpan">The time span.</param>
 /// <returns>An interruptible handle for external control of the ticker.</returns>
 public static IInterruptible Periodically(
     FirePeriodicallyTicker tickerDelegate,
     TimeSpan timeSpan) =>
 new FirePeriodicallyContext(
     tickerDelegate,
     null,
     timeSpan);
예제 #2
0
 /// <summary>
 ///     Runs the specified ticker delegate periodically.
 /// </summary>
 /// <param name="tickerDelegate">The ticker delegate.</param>
 /// <param name="milliseconds">The milliseconds.</param>
 /// <returns>An interruptible handle for external control of the ticker.</returns>
 public static IInterruptible Periodically(
     FirePeriodicallyTicker tickerDelegate,
     int milliseconds) =>
 new FirePeriodicallyContext(
     tickerDelegate,
     null,
     milliseconds);
예제 #3
0
 /// <summary>
 ///     Runs the specified ticker delegate periodically.
 /// </summary>
 /// <param name="tickerDelegate">The ticker delegate.</param>
 /// <param name="payload">The payload.</param>
 /// <param name="timeSpan">The time span.</param>
 /// <returns>An interruptible handle for external control of the ticker.</returns>
 public static IInterruptible Periodically(
     FirePeriodicallyTicker tickerDelegate,
     object payload,
     TimeSpan timeSpan) =>
 new FirePeriodicallyContext(
     tickerDelegate,
     payload,
     timeSpan);
예제 #4
0
 /// <summary>
 ///     Runs the specified ticker delegate periodically.
 /// </summary>
 /// <param name="tickerDelegate">The ticker delegate.</param>
 /// <param name="payload">The payload.</param>
 /// <param name="milliseconds">The milliseconds.</param>
 /// <returns>An interruptible handle for external control of the ticker.</returns>
 public static IInterruptible Periodically(
     FirePeriodicallyTicker tickerDelegate,
     object payload,
     int milliseconds) =>
 new FirePeriodicallyContext(
     tickerDelegate,
     payload,
     milliseconds);
예제 #5
0
 internal FirePeriodicallyContext(
     FirePeriodicallyTicker tickerDelegate,
     object?state,
     int milliseconds)
     : this(
         tickerDelegate,
         state,
         TimeSpan.FromMilliseconds(milliseconds))
 {
 }
예제 #6
0
 internal FirePeriodicallyContext(
     FirePeriodicallyTicker tickerDelegate,
     object?state,
     TimeSpan timeSpan)
     : this(
         tickerDelegate,
         state,
         TimeSpan.Zero,
         timeSpan)
 {
 }
예제 #7
0
 internal FirePeriodicallyContext(
     FirePeriodicallyTicker tickerDelegate,
     object?state,
     TimeSpan initialDelay,
     TimeSpan timeSpan)
 {
     this.state    = state;
     this.timeSpan = timeSpan;
     timer         = new Timer(
         TimerTick !,
         Requires.NotNull(tickerDelegate),
         initialDelay,
         timeSpan);
 }