Empeld
Empeld plugin documentation.
pluginbase.Objects.Tasks.ChainedTask Class Reference

Consider using the Promise infrastructure for dependable and completable/returnable values. This chaining is good when you have a non-Promise task that needs chaining More...

Inheritance diagram for pluginbase.Objects.Tasks.ChainedTask:
pluginbase.Objects.Tasks.ITask

Public Member Functions

ChainedTask Then (ITask task)
 Add a task to run after the current set of tasks More...
 
ChainedTask Finally (Action< Exception > action)
 Always executes the action after all actions succeed or fail More...
 

Static Public Member Functions

static ChainedTask Chain (params ITask[] tasks)
 
static ChainedTask Create ()
 

Additional Inherited Members

- Properties inherited from pluginbase.Objects.Tasks.ITask
TimeSpan Frequency [get]
 

Detailed Description

Consider using the Promise infrastructure for dependable and completable/returnable values. This chaining is good when you have a non-Promise task that needs chaining

Member Function Documentation

◆ Chain()

static ChainedTask pluginbase.Objects.Tasks.ChainedTask.Chain ( params ITask []  tasks)
static

Attribute: 0

as ChainedTask;

Attribute: i

);

20  {
21  if (tasks.Length == 0)
22  {
23  throw new ArgumentException("Tasks");
24  }
25 
26  ChainedTask chain = tasks[0] as ChainedTask;
27  if (chain != null && chain._finally.Count == 0) //Can't add after a promise
28  {
29  //Append to an existing chained task
30  for (int i=1; i<tasks.Length; ++i)
31  chain.Then(tasks [i]);
32  }
33  else
34  {
35  //Create a new chained task
36  chain = new ChainedTask();
37  foreach (var task in tasks)
38  chain.Then(task);
39  }
40  return chain;
41  }

◆ Create()

static ChainedTask pluginbase.Objects.Tasks.ChainedTask.Create ( )
static
44  {
45  return new ChainedTask();
46  }

◆ Finally()

ChainedTask pluginbase.Objects.Tasks.ChainedTask.Finally ( Action< Exception >  action)

Always executes the action after all actions succeed or fail

Parameters
actionAction.
63  {
64  _finally.AddLast(action);
65  return this;
66  }

◆ Then()

ChainedTask pluginbase.Objects.Tasks.ChainedTask.Then ( ITask  task)

Add a task to run after the current set of tasks

Parameters
taskTask.
53  {
54  _chain.AddLast(task);
55  return this;
56  }

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