예제 #1
0
 /// <summary>
 /// Disposes off all timers previously created with either of the methods
 /// <see cref="SetTimeout(SmartConsole, Action{TimerEventArgs}, double, string)"/>
 /// and <see cref="SetInterval(SmartConsole, Action{TimerEventArgs}, double, string)"/>.
 /// </summary>
 /// <param name="console">The used <see cref="SmartConsole"/>.</param>
 /// <returns>A reference to the current <see cref="SmartConsole" /> instance.</returns>
 public static SmartConsole ClearTimers(this SmartConsole console)
 {
     TimerManager.Clear();
     return(console);
 }
예제 #2
0
 /// <summary>
 /// Creates a timer that executes the specified <paramref name="callback"/>
 /// once after the delay specified by <paramref name="millisecondsDelay"/>.
 /// </summary>
 /// <param name="console">The used <see cref="SmartConsole"/>.</param>
 /// <param name="callback">The action to invoke on each timer tick.</param>
 /// <param name="millisecondsDelay">The number of milliseconds to wait
 /// before calling the callback.</param>
 /// <param name="name">The name of the associated timer. Useful when
 /// calling <see cref="ClearTimeout(SmartConsole, string)"/>.</param>
 /// <returns>A reference to the current <see cref="SmartConsole" /> instance.</returns>
 public static SmartConsole SetTimeout(this SmartConsole console, Action <TimerEventArgs> callback, double millisecondsDelay, string name = null)
 {
     TimerManager.Add(console, callback, millisecondsDelay, name, repeat: false);
     return(console);
 }
예제 #3
0
 /// <summary>
 /// Disposes off a timer previously created with the method
 /// <see cref="SetTimeout(SmartConsole, Action{TimerEventArgs}, double, string)"/>.
 /// </summary>
 /// <param name="console">The used <see cref="SmartConsole"/>.</param>
 /// <param name="name">The name of the associated timer to dispose.</param>
 /// <returns>A reference to the current <see cref="SmartConsole" /> instance.</returns>
 public static SmartConsole ClearTimeout(this SmartConsole console, string name)
 {
     TimerManager.Remove(name);
     return(console);
 }
예제 #4
0
 /// <summary>
 /// Creates a timer that executes the specified <paramref name="callback"/>
 /// at a regular interval specified by <paramref name="millisecondsInterval"/>.
 /// </summary>
 /// <param name="console">The used <see cref="SmartConsole"/>.</param>
 /// <param name="callback">The action to invoke on each timer tick.</param>
 /// <param name="millisecondsInterval">The number of milliseconds that
 /// should elapse between two consecutive ticks.</param>
 /// <param name="name">The name of the associated timer. Useful when
 /// calling <see cref="ClearInterval(SmartConsole, string)"/>.</param>
 /// <returns>A reference to the current <see cref="SmartConsole" /> instance.</returns>
 public static SmartConsole SetInterval(this SmartConsole console, Action <TimerEventArgs> callback, double millisecondsInterval, string name = null)
 {
     TimerManager.Add(console, callback, millisecondsInterval, name, repeat: true);
     return(console);
 }