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

Static Public Member Functions

static ChainedTask Then (this ITask task, Action method)
 Execute an action More...
 
static ChainedTask Then (this ITask task, Action method, TimeSpan delay)
 Execute an action after a delay More...
 
static ChainedTask Then (this ITask task, Action method, int repeat, TimeSpan delay)
 Execute an action n times, with a delay More...
 
static ChainedTask Then (this ITask task, Func< TaskResult > method, TimeSpan frequency)
 Execute an action with a frequency until done More...
 
static ChainedTask Then (this ITask task, Func< IEnumerable< ITaskYieldAction >> yieldingTask)
 Execute a chained task More...
 
static ChainedTask Wait (this ITask task, TimeSpan timespan)
 Wait a timespan More...
 
static ChainedTask Wait (this ITask task, double seconds)
 Wait a timespan More...
 
static ChainedTask Wait (this ITask task, Func< bool > until)
 Wait until a delegate return true More...
 
static ChainedTask Wait (this ITask task, TimeSpan timespan, Action< double > tick, TimeSpan tickSpeed)
 Wait for a duration of time, and execute a tick after every increment More...
 
static ChainedTask Wait (this ITask task, TimeSpan timespan, Action< double > tick)
 Wait for a duration of time, and execute a tick after every 0.25 second increment More...
 
static ChainedTask Promise (this ITask task, Action< Exception > promise)
 Promise the specified task will always run after the task completes or fails More...
 
static ChainedTask Promise (this ITask task)
 Promises the task will finish running and now explode More...
 

Member Function Documentation

static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Promise ( this ITask  task,
Action< Exception >  promise 
)
static

Promise the specified task will always run after the task completes or fails

Parameters
taskTask.
promisePromise.
129  {
130  return ChainedTask.Chain(task).Promise(promise);
131  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Promise ( this ITask  task)
static

Promises the task will finish running and now explode

Parameters
taskTask.
138  {
139  return ChainedTask.Chain(task).Promise(x => {});
140  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Then ( this ITask  task,
Action  method 
)
static

Execute an action

Parameters
taskTask.
methodMethod.
14  {
15  return ChainedTask.Chain(task, new SingleTask(method, TimeSpan.Zero));
16  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Then ( this ITask  task,
Action  method,
TimeSpan  delay 
)
static

Execute an action after a delay

Parameters
taskTask.
methodMethod.
delayDelay.
25  {
26  return ChainedTask.Chain(task, new SingleTask(method, delay));
27  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Then ( this ITask  task,
Action  method,
int  repeat,
TimeSpan  delay 
)
static

Execute an action n times, with a delay

Parameters
taskTask.
methodMethod.
repeatRepeat.
delayDelay.
37  {
38  return ChainedTask.Chain(task, new RepeatingTask(method, repeat, delay));
39  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Then ( this ITask  task,
Func< TaskResult method,
TimeSpan  frequency 
)
static

Execute an action with a frequency until done

Parameters
taskTask.
methodMethod.
frequencyFrequency.
48  {
49  return ChainedTask.Chain(task, new RecurringTask(method, frequency));
50  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Then ( this ITask  task,
Func< IEnumerable< ITaskYieldAction >>  yieldingTask 
)
static

Execute a chained task

Parameters
taskTask.
yieldingTaskYielding task.
58  {
59  return ChainedTask.Chain(task, new YieldingTask(yieldingTask));
60  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Wait ( this ITask  task,
TimeSpan  timespan 
)
static

Wait a timespan

Parameters
taskTask.
timespanTimespan.
68  {
69  return ChainedTask.Chain(task, new SingleTask(() => {}, timespan));
70  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Wait ( this ITask  task,
double  seconds 
)
static

Wait a timespan

Parameters
taskTask.
secondsSeconds.
78  {
79  return ChainedTask.Chain(task, new SingleTask(() => {}, TimeSpan.FromSeconds(seconds)));
80  }
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Wait ( this ITask  task,
Func< bool >  until 
)
static

Wait until a delegate return true

Parameters
taskTask.
untilUntil.
88  {
89  return ChainedTask.Chain(task, new RecurringTask( () => until() ? TaskResult.Remove : TaskResult.Continue, TimeSpan.FromSeconds(0.1) ));
90  }
TaskResult
The result of a scheduled task
Definition: TaskResult.cs:8
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Wait ( this ITask  task,
TimeSpan  timespan,
Action< double >  tick,
TimeSpan  tickSpeed 
)
static

Wait for a duration of time, and execute a tick after every increment

Parameters
taskTask.
timespanTimespan.
tickTick.
tickSpeedTick speed.
100  {
101  int repeatCount = (int)Math.Ceiling(timespan.TotalSeconds / tickSpeed.TotalSeconds);
102  int i = 0;
103  return Then(task,
104  () => {
105  i++;
106  tick(tickSpeed.TotalSeconds * i);
107  },
108  repeatCount,
109  tickSpeed);
110  }
static ChainedTask Then(this ITask task, Action method)
Execute an action
Definition: ChainedTaskExtensions.cs:13
static ChainedTask pluginbase.Objects.Tasks.ChainedTaskExtensions.Wait ( this ITask  task,
TimeSpan  timespan,
Action< double >  tick 
)
static

Wait for a duration of time, and execute a tick after every 0.25 second increment

Parameters
taskTask.
timespanTimespan.
tickTick.
119  {
120  return Wait(task, timespan, tick, TimeSpan.FromSeconds(0.25));
121  }
static ChainedTask Wait(this ITask task, TimeSpan timespan)
Wait a timespan
Definition: ChainedTaskExtensions.cs:67

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