Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Objects.Tasks.SchedulerExtensions Class Reference

Adds various helper extension methods to the scheduler More...

Static Public Member Functions

static IScheduledTask ScheduleRecurringTask (this ITaskScheduler scheduler, Func< TaskResult > method, TimeSpan frequency)
 Schedules a task that will repeat until it returns a stop result More...
 
static IScheduledTask ScheduleInfiniteTask (this ITaskScheduler scheduler, Action method, TimeSpan frequency)
 Schedules a task that will be run until the termination of the context More...
 
static IScheduledTask ScheduleTask (this ITaskScheduler scheduler, Action method, TimeSpan inTime)
 Schedule a task to happen one time in the future More...
 
static IScheduledTask ScheduleTask (this ITaskScheduler scheduler, Action method, DateTime forTimeUtc)
 Schedule a task to happen one time in the future More...
 
static IScheduledTask IterateSystem (this ITaskScheduler scheduler, Func< int, TaskResult > method)
 Schedules an iterable system It will increment the first parameter, running multiple times in a frame until 'Remove' is returned More...
 
static IScheduledTask IterateSystem (this ITaskScheduler scheduler, IIterableSystem system)
 Iterate a system. See IIterableSystem More...
 
static IScheduledTask ScheduleYieldingTask (this ITaskScheduler scheduler, Func< IEnumerable< ITaskYieldAction >> method)
 Schedule a yielding task. This task can yield specific classes to control the flow of the task See: YieldNext, YieldReset, YieldWait, YieldTask More...
 
static IScheduledTask ScheduleWeakTask (this ITaskScheduler scheduler, Func< TaskResult > method, TimeSpan frequency)
 Schedules a weak-bound task. Great if you're not sure you can dispose of it properly. Must be a class-method, can not be lambda or closure More...
 
static IScheduledTask ScheduleInfiniteWeakTask (this ITaskScheduler scheduler, Action method, TimeSpan frequency)
 Schedule a recurring task that's called for as long as an object exists More...
 

Detailed Description

Adds various helper extension methods to the scheduler

Member Function Documentation

static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.IterateSystem ( this ITaskScheduler  scheduler,
Func< int, TaskResult method 
)
static

Schedules an iterable system It will increment the first parameter, running multiple times in a frame until 'Remove' is returned

Returns
THe task instance
Parameters
schedulerScheduler.
methodMethod to be run.
73  {
74  var task = new IterativeTask(method);
75  return scheduler.ScheduleTask(task);
76  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.IterateSystem ( this ITaskScheduler  scheduler,
IIterableSystem  system 
)
static

Iterate a system. See IIterableSystem

Returns
The task instance.
Parameters
schedulerScheduler.
systemSystem instance to be iterated
85  {
86  var task = new IterativeTask(system);
87  return scheduler.ScheduleTask(task);
88  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleInfiniteTask ( this ITaskScheduler  scheduler,
Action  method,
TimeSpan  frequency 
)
static

Schedules a task that will be run until the termination of the context

Returns
The task instance.
Parameters
schedulerScheduler.
methodMethod to be run
frequencyFrequency at which method will be invoked
34  {
35  var task = new RecurringTask(method, frequency);
36  return scheduler.ScheduleTask(task);
37  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleInfiniteWeakTask ( this ITaskScheduler  scheduler,
Action  method,
TimeSpan  frequency 
)
static

Schedule a recurring task that's called for as long as an object exists

Returns
The weak task.
Parameters
schedulerScheduler.
methodMethod.
frequencyFrequency.
125  {
126  var task = new WeakTask(method, frequency);
127  return scheduler.ScheduleTask(task);
128  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleRecurringTask ( this ITaskScheduler  scheduler,
Func< TaskResult method,
TimeSpan  frequency 
)
static

Schedules a task that will repeat until it returns a stop result

Returns
The task instance.
Parameters
schedulerScheduler.
methodMethod to be run
frequencyFrequency at which method will be invoked
21  {
22  var task = new RecurringTask(method, frequency);
23  return scheduler.ScheduleTask(task);
24  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleTask ( this ITaskScheduler  scheduler,
Action  method,
TimeSpan  inTime 
)
static

Schedule a task to happen one time in the future

Returns
The task instance.
Parameters
schedulerScheduler.
methodMethod to invoke
inTimeTime in the future to run it
47  {
48  var task = new SingleTask(method, inTime);
49  return scheduler.ScheduleTask(task);
50  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleTask ( this ITaskScheduler  scheduler,
Action  method,
DateTime  forTimeUtc 
)
static

Schedule a task to happen one time in the future

Returns
The task instance.
Parameters
schedulerScheduler.
methodMethod to invoke.
forTimeUtcThe time at which to invoke at
60  {
61  var task = new SingleTask(method, forTimeUtc - DateTime.UtcNow );
62  return scheduler.ScheduleTask(task);
63  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleWeakTask ( this ITaskScheduler  scheduler,
Func< TaskResult method,
TimeSpan  frequency 
)
static

Schedules a weak-bound task. Great if you're not sure you can dispose of it properly. Must be a class-method, can not be lambda or closure

Returns
The task instance.
Parameters
schedulerScheduler.
methodMethod to invoke
frequencyFrequency to invoke at
112  {
113  var task = new WeakTask(method, frequency);
114  return scheduler.ScheduleTask(task);
115  }
static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.ScheduleYieldingTask ( this ITaskScheduler  scheduler,
Func< IEnumerable< ITaskYieldAction >>  method 
)
static

Schedule a yielding task. This task can yield specific classes to control the flow of the task See: YieldNext, YieldReset, YieldWait, YieldTask

Returns
The task isntance.
Parameters
schedulerScheduler.
methodMethod to invoke.
98  {
99  var task = new YieldingTask(method);
100  return scheduler.ScheduleTask(task);
101  }

The documentation for this class was generated from the following file: