Class AgentTaskManager
Namespace: i5.VirtualAgents.ScheduleBasedExecution
Assembly: cs.temp.dll.dll
Syntax
public class AgentTaskManager
Constructors
AgentTaskManager()
Creates a new task manager but does not yet associate an agent with it If you use this method, you need to call the AssociateAgent method at some point before scheduled tasks can be executed
Declaration
public AgentTaskManager()
AgentTaskManager(Agent)
Creates a new task manager and associates with an agent
Declaration
public AgentTaskManager(Agent agent)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | The agent on which scheduled tasks should be executed |
Properties
CurrentState
Agent's current state
Declaration
public TaskManagerState CurrentState { get; }
Property Value
Type | Description |
---|---|
TaskManagerState |
CurrentTask
Agent's current task
Declaration
public IAgentTask CurrentTask { get; }
Property Value
Type | Description |
---|---|
IAgentTask |
ExecutingAgent
Agent which will execute the scheduled tasks
Declaration
public Agent ExecutingAgent { get; }
Property Value
Type | Description |
---|---|
Agent |
IsActive
Checks whether the task manager is active or has been deactivated Only returns false if the task manager has explicitly been deactivated
Declaration
public bool IsActive { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AssociateAgent(Agent)
Associates an agent with the task manager Scheduled tasks can only run if an agent was registered with the task manager, either using this method or the constructor which takes an agent as an argument
Declaration
public void AssociateAgent(Agent agent)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | The agent which should execute the scheduled tasks |
PeekNextTask()
Peeks at the next task that the task manager will execute after the current one
Declaration
public IAgentTask PeekNextTask()
Returns
Type | Description |
---|---|
IAgentTask | Returns the next task to execute, null if no task is upcoming |
ScheduleTask(IAgentTask, Int32)
Schedules a task in the queue, sorted by the given priority
Declaration
public void ScheduleTask(IAgentTask task, int priority = 0)
Parameters
Type | Name | Description |
---|---|---|
IAgentTask | task | The task that should be scheduled for execution |
Int32 | priority | Priority of the task. Tasks with high importance should get a positive value, less important tasks a negative value. Default tasks have a priority of 0. |
Update()
Enable the right mode depending on the agent's status
Declaration
public void Update()
Events
OnStateChanged
Event which is raised once the agent's state changes
Declaration
public event Action OnStateChanged
Event Type
Type | Description |
---|---|
Action |
OnTaskFinished
Event which is raised once the agent has finished the current task
Declaration
public event AgentTaskManager.TaskFinishedEvent OnTaskFinished
Event Type
Type | Description |
---|---|
AgentTaskManager.TaskFinishedEvent |