Interface ISequencer<TSequenceable>
An ISequencer<TSequenceable> queues and runs a collection of ISequenceable objects. These objects can be run sequentially or in parallel as the queue is processed.
Inherited Members
Namespace: IdleKit.Core
Assembly: cs.temp.dll.dll
Syntax
public interface ISequencer<TSequenceable> : IProgressable, IInjectable where TSequenceable : class, ISequenceable
Type Parameters
Name | Description |
---|---|
TSequenceable | The type of ISequenceable that this ISequencer<TSequenceable> can run. |
Properties
IsRunning
Returns true if the queue is currently being processed.
Declaration
bool IsRunning { get; }
Property Value
Type | Description |
---|---|
Boolean |
Sequenceables
Returns the list of ISequenceable objects currently in the queue.
Declaration
List<TSequenceable> Sequenceables { get; }
Property Value
Type | Description |
---|---|
List<TSequenceable> |
Methods
Cancel(TSequenceable)
Cancels a specific ISequenceable if it is currently running.
Declaration
void Cancel(TSequenceable sequenceable)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable | sequenceable | The ISequenceable object to cancel. |
CancelAll()
Cancels all running ISequenceable objects that are currently running.
Declaration
void CancelAll()
Cleanup()
Clean up the ISequencer<TSequenceable> and all its dependencies.
Declaration
void Cleanup()
CreateParallelSequenceableCollection(TSequenceable[])
Creates, populates and returns a IParallelSequenceCollection<TSequenceable> that contains the passed ISequenceable objects to be loaded in parallel.
Declaration
IParallelSequenceCollection<TSequenceable> CreateParallelSequenceableCollection(TSequenceable[] sequenceables)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable[] | sequenceables | The ISequenceable objects to load in parallel. |
Returns
Type | Description |
---|---|
IParallelSequenceCollection<TSequenceable> |
Enqueue(SequenceFlow, TSequenceable[])
Adds one or more ISequenceable objects to the queue with a SequenceFlow behaviour.
Declaration
void Enqueue(SequenceFlow flow, params TSequenceable[] sequenceables)
Parameters
Type | Name | Description |
---|---|---|
SequenceFlow | flow | The SequenceFlow behaviour that the added ISequenceable objects should have when run. |
TSequenceable[] | sequenceables | The ISequenceable objects to add to the queue. |
GenerateReport()
Returns a report that contains details on the processing of this ISequencer<TSequenceable>.
Declaration
string GenerateReport()
Returns
Type | Description |
---|---|
String |
InsertAfter(TSequenceable, SequenceFlow, TSequenceable[])
Adds one or more ISequenceable objects to the spot in the queue directly after a specific ISequenceable with a SequenceFlow behaviour.
Declaration
void InsertAfter(TSequenceable existingSequenceable, SequenceFlow flow, params TSequenceable[] newSequenceables)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable | existingSequenceable | The target ISequenceable object to insert these objects after. |
SequenceFlow | flow | The SequenceFlow behaviour that the added ISequenceable objects should have when run. |
TSequenceable[] | newSequenceables | The ISequenceable objects to insert into the queue. |
InsertBefore(TSequenceable, SequenceFlow, TSequenceable[])
Adds one or more ISequenceable objects to the spot in the queue directly before a specific ISequenceable with a SequenceFlow behaviour.
Declaration
void InsertBefore(TSequenceable existingSequenceable, SequenceFlow flow, params TSequenceable[] newSequenceables)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable | existingSequenceable | The target ISequenceable object to insert these objects before. |
SequenceFlow | flow | The SequenceFlow behaviour that the added ISequenceable objects should have when run. |
TSequenceable[] | newSequenceables | The ISequenceable objects to insert into the queue. |
Remove(TSequenceable)
Removes a specific ISequenceable from the queue.
Declaration
bool Remove(TSequenceable sequenceable)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable | sequenceable | The ISequenceable object to remove from the queue. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the ISequenceable object was removed successfully. |
Reset()
Reset the queue and any other internal state.
Declaration
void Reset()
RevertTo(TSequenceable, Boolean)
If the target ISequenceable object has already run this rolls the queue back to that object and re-runs it from there.
Declaration
void RevertTo(TSequenceable sequenceable, bool resumeRunning)
Parameters
Type | Name | Description |
---|---|---|
TSequenceable | sequenceable | The ISequenceable object to roll back to. |
Boolean | resumeRunning | If true, the ISequencer<TSequenceable> will run from the ISequenceable it reverted to. |
Start()
Start processing the queue of ISequenceable objects.
Declaration
void Start()
Events
OnSequenceableCanceled
Broadcast when a ISequenceable object has been canceled.
Declaration
event Action<TSequenceable> OnSequenceableCanceled
Event Type
Type | Description |
---|---|
Action<TSequenceable> |
OnSequenceableCompleted
Broadcast when a ISequenceable object has finished running.
Declaration
event Action<TSequenceable> OnSequenceableCompleted
Event Type
Type | Description |
---|---|
Action<TSequenceable> |
OnSequenceableException
Broadcast if an error occurs while running a ISequenceable object.
Declaration
event Action<TSequenceable, Exception> OnSequenceableException
Event Type
Type | Description |
---|---|
Action<TSequenceable, Exception> |
OnSequenceableReverted
Broadcast when a ISequenceable object has been reverted.
Declaration
event Action<TSequenceable> OnSequenceableReverted
Event Type
Type | Description |
---|---|
Action<TSequenceable> |
OnSequenceableStarted
Broadcast when a ISequenceable object has been started.
Declaration
event Action<TSequenceable> OnSequenceableStarted
Event Type
Type | Description |
---|---|
Action<TSequenceable> |