This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Linq; | |
using System.Xml.Linq; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.Globalization; | |
using System.Reflection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Simple repeater based on a timed interval | |
/// </summary> | |
public static class TaskRepeater | |
{ | |
public static Task Interval(TimeSpan pollInterval, Action action, CancellationToken token, bool runImmediately = false) | |
{ | |
// We don't use Observable.Interval: | |
// If we block, the values start bunching up behind each other. | |
return Task.Factory.StartNew( |