Skip to content

Repository files navigation

ScheduleMagic

A simple ASP.NET task scheduler.

Create a Task

To create a task, simply create a class that implements IScheduledTask.

publicclassGenericTask:IScheduledTask{publicvoidDoWork(){// do something}}

Register the Task

To initialize the task (which is usually done when the application starts), invoke the scheduler with an instance of a schedule (you can use a default schedule, or create a schedule of your own).

publicclassGlobal:System.Web.HttpApplication{protectedvoidApplication_Start(objectsender,EventArgse){Scheduler.Schedule<GenericTask>(newDaily(3,30,"Eastern Standard Time"));}}

(Optional) Create a Schedule

To create a new schedule, create a class that implements ISchedule.

publicclassInterval:ISchedule{privatelong_seconds;publicInterval(longseconds){_seconds=seconds;}publicDateTimeGetUtcExpirationDate(){returnDateTime.UtcNow.AddSeconds(_seconds);}}

About

Simple Task Scheduler for ASP.NET

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages