Thanks to visit codestin.com
Credit goes to github.com

Skip to content

therealloft/TaskScheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Scheduler

A lightweight, flexible task scheduler for .NET applications designed to schedule tasks dynamically with an easy-to-use API. This scheduler supports one-time and recurring tasks using a simple interface for task execution.

Features

  • Schedule tasks dynamically at runtime.
  • Support for both one-time and recurring tasks.
  • Customizable task execution intervals.
  • Simple interface to implement custom task handling logic.
  • Thread-safe task addition and removal.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • .NET Framework or .NET Core installed on your machine.

Installing

To use the Task Scheduler in your project, follow these steps:

  1. Clone the repository or download the source code.
  2. Include the Scheduler namespace in your project.
  3. Implement the ITaskHandler interface to define how tasks should be executed.

Usage

Here is a basic example of how to use the Task Scheduler:

  1. Implement the ITaskHandler interface:
using Scheduler;

public class MyTaskHandler : ITaskHandler
{
    public void DoTask(Task task)
    {
        // Task execution logic goes here.
    }
}

Create a task and schedule it:

var scheduler = new TaskScheduler();
var myTask = new Task();
var myTaskHandler = new MyTaskHandler();

// Schedule the task for execution every 10 seconds, looping indefinitely.
scheduler.AddScheduledTask(myTask, 10, true, myTaskHandler);

// Start the task scheduler.
scheduler.StartService();

API Reference

TaskScheduler: The main class responsible for managing and executing scheduled tasks. ITaskHandler: Interface that needs to be implemented to handle the execution of tasks. Task: Represents a task with an ID, parameters, and active state. ScheduledTask: Represents a scheduled task with execution details.

Contributing

Please feel free to contribute.

License

This project is licensed under the MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages