Class WorkActionFactory
Extension methods for the WorkAction class.
Namespace: Evergine.Components.WorkActions
Assembly: Evergine.Components.dll
Syntax
public static class WorkActionFactory
Methods
AndWaitCondition(IWorkAction, Func<bool>, int)
Awaits the specified condition.
Declaration
public static IWorkAction AndWaitCondition(this IWorkAction parent, Func<bool> breakPredicate, int eventCount = 1)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent. |
Func<bool> | breakPredicate | The predicate. |
int | eventCount | The event count. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
AsSkippableWorkAction(IWorkAction)
Returns the same action as skippable.
Declaration
public static IWorkAction AsSkippableWorkAction(this IWorkAction actionToSkip)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | actionToSkip | The action to skip. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
ContinueWith(IWorkAction, IWorkAction)
Continue with another action.
Declaration
public static IWorkAction ContinueWith(this IWorkAction parent, IWorkAction nextAction)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
IWorkAction | nextAction | The next action. |
Returns
Type | Description |
---|---|
IWorkAction | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
ContinueWith(IWorkAction, params IWorkAction[])
Continue with another action.
Declaration
public static IWorkActionSet ContinueWith(this IWorkAction parent, params IWorkAction[] childTasks)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
IWorkAction[] | childTasks | The child tasks. |
Returns
Type | Description |
---|---|
IWorkActionSet | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
ContinueWith(IWorkAction, IEnumerable<IWorkAction>)
Continue with another action.
Declaration
public static IWorkActionSet ContinueWith(this IWorkAction parent, IEnumerable<IWorkAction> childTasks)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
IEnumerable<IWorkAction> | childTasks | The child tasks. |
Returns
Type | Description |
---|---|
IWorkActionSet | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
ContinueWith(IWorkAction, Func<IWorkAction>)
Continue with another action.
Declaration
public static IWorkAction ContinueWith(this IWorkAction parent, Func<IWorkAction> nextActionGenerator)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
Func<IWorkAction> | nextActionGenerator | The next action generator. |
Returns
Type | Description |
---|---|
IWorkAction | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
ContinueWith(IWorkAction, params Func<IWorkAction>[])
Continue with another action.
Declaration
public static IWorkActionSet ContinueWith(this IWorkAction parent, params Func<IWorkAction>[] childTaskGenerators)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
Func<IWorkAction>[] | childTaskGenerators | The child task generators. |
Returns
Type | Description |
---|---|
IWorkActionSet | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
ContinueWithAction(IWorkAction, Action)
Continue with another action function.
Declaration
public static IWorkAction ContinueWithAction(this IWorkAction parent, Action action)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
Action | action | The next action. |
Returns
Type | Description |
---|---|
IWorkAction | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
CreateDelayWorkAction(Scene, TimeSpan)
Creates a delay action.
Declaration
public static IWorkAction CreateDelayWorkAction(this Scene scene, TimeSpan time)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
TimeSpan | time | The time. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateEmptyWorkAction(Scene)
Creates an empty work action.
Declaration
public static IWorkAction CreateEmptyWorkAction(this Scene scene)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateLoopWorkActionUntil(Scene, Func<IWorkAction>, Func<bool>)
Creates the repeat task until.
Declaration
public static IWorkAction CreateLoopWorkActionUntil(this Scene scene, Func<IWorkAction> actionGenerator, Func<bool> stopCondition)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Func<IWorkAction> | actionGenerator | The action generator. |
Func<bool> | stopCondition | The stop predicate. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateParallelWorkActions(Scene, params IWorkAction[])
Creates parallel actions.
Declaration
public static IWorkActionSet CreateParallelWorkActions(this Scene scene, params IWorkAction[] actions)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
IWorkAction[] | actions | The actions. |
Returns
Type | Description |
---|---|
IWorkActionSet | The action. |
CreateParallelWorkActions(Scene, IEnumerable<IWorkAction>)
Creates parallel actions.
Declaration
public static IWorkActionSet CreateParallelWorkActions(this Scene scene, IEnumerable<IWorkAction> actions)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
IEnumerable<IWorkAction> | actions | The actions. |
Returns
Type | Description |
---|---|
IWorkActionSet | The action. |
CreateParallelWorkActions(Scene, IEnumerable<Func<IWorkAction>>)
Create parallel actions.
Declaration
public static IWorkActionSet CreateParallelWorkActions(this Scene scene, IEnumerable<Func<IWorkAction>> actionGenerators)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
IEnumerable<Func<IWorkAction>> | actionGenerators | The action generators. |
Returns
Type | Description |
---|---|
IWorkActionSet | The action. |
CreateParallelWorkActions(Scene, params Func<IWorkAction>[])
Creates parallel actions.
Declaration
public static IWorkActionSet CreateParallelWorkActions(this Scene scene, params Func<IWorkAction>[] actionGenerators)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Func<IWorkAction>[] | actionGenerators | The action generators. |
Returns
Type | Description |
---|---|
IWorkActionSet | The action. |
CreateParallelWorkActions(IWorkAction, IEnumerable<IWorkAction>)
Continue with another action.
Declaration
public static IWorkActionSet CreateParallelWorkActions(this IWorkAction parent, IEnumerable<IWorkAction> childTasks)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent action. |
IEnumerable<IWorkAction> | childTasks | The child tasks. |
Returns
Type | Description |
---|---|
IWorkActionSet | An action that continues with the next action when the parent is completed. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | It is not possible to continue with an aborted or finished task. Defer the run command to a later stage. |
CreateWaitConditionWorkAction(Scene, Func<bool>, int)
Creates a wait condition action.
Declaration
public static IWorkAction CreateWaitConditionWorkAction(this Scene scene, Func<bool> breakPredicate, int eventCount = 1)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Func<bool> | breakPredicate | The predicate. |
int | eventCount | The event count. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateWaitWorkAction(Scene, TimeSpan)
Creates the wait action.
Declaration
public static IWorkAction CreateWaitWorkAction(this Scene scene, TimeSpan timeSpan)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
TimeSpan | timeSpan | The timespan. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateWorkAction(Scene, IWorkAction)
Creates a work action.
Declaration
public static IWorkAction CreateWorkAction(this Scene scene, IWorkAction action)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
IWorkAction | action | The action. |
Returns
Type | Description |
---|---|
IWorkAction | The work action. |
CreateWorkAction(Scene, Func<IWorkAction>)
Creates a work action.
Declaration
public static IWorkAction CreateWorkAction(this Scene scene, Func<IWorkAction> actionGenerator)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Func<IWorkAction> | actionGenerator | The action generator method. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
CreateWorkActionFromAction(Scene, Action)
Creates an empty work action.
Declaration
public static IWorkAction CreateWorkActionFromAction(this Scene scene, Action action)
Parameters
Type | Name | Description |
---|---|---|
Scene | scene | The scene. |
Action | action | Simple code to be executed. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |
Delay(IWorkAction, TimeSpan)
Adds a delay action.
Declaration
public static IWorkAction Delay(this IWorkAction parent, TimeSpan time)
Parameters
Type | Name | Description |
---|---|---|
IWorkAction | parent | The parent. |
TimeSpan | time | The time. |
Returns
Type | Description |
---|---|
IWorkAction | The action. |