Empeld
Empeld plugin documentation.
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...
 
static IScheduledTask Enumerate< T > (this ITaskScheduler scheduler, IEnumerable< T > e, Func< T, TaskResult > eval, TimeSpan freq)
 Enumerate through each item in the IEnumerable and runs an evaluator against them More...
 
static IScheduledTask Enumerate< T > (this ITaskScheduler scheduler, IEnumerable< T > e, Func< T, TaskResult > eval)
 Enumerate through each item in the IEnumerable and runs an evaluator against them More...
 
static IScheduledTask Enumerate< T > (this ITaskScheduler scheduler, IEnumerable< T > e, Action< T > eval, TimeSpan freq)
 Enumerate through each item in the IEnumerable and runs an evaluator against them More...
 
static IScheduledTask Enumerate< T > (this ITaskScheduler scheduler, IEnumerable< T > e, Action< T > eval)
 Enumerate through each item in the IEnumerable and runs an evaluator against them More...
 

Detailed Description

Adds various helper extension methods to the scheduler

Member Function Documentation

◆ Enumerate< T >() [1/4]

static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.Enumerate< T > ( this ITaskScheduler  scheduler,
IEnumerable< T >  e,
Func< T, TaskResult eval,
TimeSpan  freq 
)
static

Enumerate through each item in the IEnumerable and runs an evaluator against them

Returns
The enumerate.
Parameters
schedulerScheduler.
eE.
evalEval.
freqFreq.
Template Parameters
TThe 1st type parameter.
140  {
141  return scheduler.ScheduleTask(new EnumerableTask<T>(e, eval, freq));
142  }

◆ Enumerate< T >() [2/4]

static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.Enumerate< T > ( this ITaskScheduler  scheduler,
IEnumerable< T >  e,
Func< T, TaskResult eval 
)
static

Enumerate through each item in the IEnumerable and runs an evaluator against them

Returns
The enumerate.
Parameters
schedulerScheduler.
eE.
evalEval.
Template Parameters
TThe 1st type parameter.
153  {
154  return Enumerate<T>(scheduler, e, eval, TimeSpan.FromMilliseconds(1));
155  }
static IScheduledTask Enumerate< T >(this ITaskScheduler scheduler, IEnumerable< T > e, Func< T, TaskResult > eval, TimeSpan freq)
Enumerate through each item in the IEnumerable and runs an evaluator against them ...
Definition: SchedulerExtensions.cs:139

◆ Enumerate< T >() [3/4]

static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.Enumerate< T > ( this ITaskScheduler  scheduler,
IEnumerable< T >  e,
Action< T >  eval,
TimeSpan  freq 
)
static

Enumerate through each item in the IEnumerable and runs an evaluator against them

Returns
The enumerate.
Parameters
schedulerScheduler.
eE.
evalEval.
freqFreq.
Template Parameters
TThe 1st type parameter.
167  {
168  return scheduler.ScheduleTask(new EnumerableTask<T>(e, eval, freq));
169  }

◆ Enumerate< T >() [4/4]

static IScheduledTask pluginbase.Objects.Tasks.SchedulerExtensions.Enumerate< T > ( this ITaskScheduler  scheduler,
IEnumerable< T >  e,
Action< T >  eval 
)
static

Enumerate through each item in the IEnumerable and runs an evaluator against them

Returns
The enumerate.
Parameters
schedulerScheduler.
eE.
evalEval.
Template Parameters
TThe 1st type parameter.
180  {
181  return Enumerate<T>(scheduler, e, eval, TimeSpan.FromMilliseconds(1));
182  }
static IScheduledTask Enumerate< T >(this ITaskScheduler scheduler, IEnumerable< T > e, Func< T, TaskResult > eval, TimeSpan freq)
Enumerate through each item in the IEnumerable and runs an evaluator against them ...
Definition: SchedulerExtensions.cs:139

◆ IterateSystem() [1/2]

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  }

◆ IterateSystem() [2/2]

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  }

◆ ScheduleInfiniteTask()

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  }

◆ ScheduleInfiniteWeakTask()

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  }

◆ ScheduleRecurringTask()

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  }

◆ ScheduleTask() [1/2]

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  }

◆ ScheduleTask() [2/2]

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  }

◆ ScheduleWeakTask()

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  }

◆ ScheduleYieldingTask()

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: