/TasksOnTime

Simply enqueue (with delay) or schedule any c# task as you want and monitor it

Primary LanguageC#OtherNOASSERTION

TasksOnTime (4.3.17)

About

Start a job or schedule it in standard threadPool with monitoring and cancelation TasksOnTime Can be used in service , console, website or wpf/winforms applications

Require only .Net 4.5.2 (minimum) with no other dependance or Require only dotnetcore 3.0

Where can I get it ?

First, install Nuget then, install TasksOnTime from the package manager console.

PM> Install-Package TasksOnTime

Usages :

Each Task must implement ITask interface

public interface ITask 
{
    void Execute(ExecutionContext context);
}

Simple task

public class MyTask : ITask
{
    public void Execute(ExecutionContext context)
    {
        System.Diagnostics.Debug.WriteLine("Task executed");
    }
}

Simple task enqueing

TasksHost.Enqueue<MyTask>();

Enqueue task with delay (start after 5 seconds minimum)

TasksHost.Enqueue<MyTask>(delayInMillisecond: 5 * 1000);

See others examples :

Scheduled tasks :

For use scheduled tasks add assembly reference "TasksOnTime.Scheduling" in your project . Each task can scheduled by month, day, hour, minute or second with interval as you like. Each scheduled task can be canceled, removed or forced , each task was executed in standard threadpool. Single instance of scheduler was possible by application.

PM> Install-Package TasksOnTime.Scheduling

Task implements ITask

var scheduledTask = TasksOnTime.Scheduler.CreateScheduledTask<MyTask>("MyTask")
											.EveryMinute();

TasksOnTime.Scheduler.Add(scheduledTask);
TasksOnTime.Scheduler.Start();

...

TasksOnTime.Scheduler.Stop();

See others examples :