Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Reactive Extensions (Rx.NET) might do the job! <a href="http://msdn.microsoft.com/en-us/data/gg577609.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/data/gg577609.aspx</a></p> <p>Examples:</p> <p>This examples schedules a task execution.</p> <pre><code>Console.WriteLine("Current time: {0}", DateTime.Now); // Start event 30 seconds from now. IObservable&lt;long&gt; observable = Observable.Timer(TimeSpan.FromSeconds(30)); // Token for cancelation CancellationTokenSource source = new CancellationTokenSource(); // Create task to execute. Task task = new Task(() =&gt; Console.WriteLine("Action started at: {0}", DateTime.Now)); // Subscribe the obserable to the task on execution. observable.Subscribe(x =&gt; task.Start(), source.Token); // If you want to cancel the task do: //source.Cancel(); Console.WriteLine("Press any key to exit"); Console.ReadKey(); </code></pre> <p>Result: <img src="https://i.stack.imgur.com/xVxB3.png" alt="enter image description here"></p> <p>Example 2: </p> <p>Repeating a task every x seconds.</p> <pre><code>Console.WriteLine("Current time: {0}", DateTime.Now); // Repeat every 2 seconds. IObservable&lt;long&gt; observable = Observable.Interval(TimeSpan.FromSeconds(2)); // Token for cancelation CancellationTokenSource source = new CancellationTokenSource(); // Create task to execute. Action action = (() =&gt; Console.WriteLine("Action started at: {0}", DateTime.Now)); // Subscribe the obserable to the task on execution. observable.Subscribe(x =&gt; { Task task = new Task(action);task.Start(); },source.Token); // If you want to cancel the task do: //source.Cancel(); Console.WriteLine("Press any key to exit"); Console.ReadKey(); </code></pre> <p>Result: <img src="https://i.stack.imgur.com/ei4b2.png" alt="enter image description here"></p> <p>Example task continue:</p> <pre><code>Console.WriteLine("Current time: {0}", DateTime.Now); // Repeat every 2 seconds. IObservable&lt;long&gt; observable = Observable.Interval(TimeSpan.FromSeconds(2)); // Token for cancelation CancellationTokenSource source = new CancellationTokenSource(); // Create task to execute. Action action = (() =&gt; Console.WriteLine("Action started at: {0}", DateTime.Now)); Action resumeAction = (() =&gt; Console.WriteLine("Second action started at {0}", DateTime.Now)); // Subscribe the obserable to the task on execution. observable.Subscribe(x =&gt; { Task task = new Task(action); task.Start(); task.ContinueWith(c =&gt; resumeAction()); }, source.Token); // If you want to cancel the task do: //source.Cancel(); Console.WriteLine("Press any key to exit"); Console.ReadKey(); </code></pre> <p>Result:</p> <p><img src="https://i.stack.imgur.com/M7DgJ.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload