Class TaskCollection
Collection that manages ITask objects. It supports reading and writing task configuration from and to configuration file; starting, stoping, and disposing all tasks at once.
Implements
Inherited Members
Namespace: Nevatech.Vsb.Agent
Assembly: Nevatech.Vsb.Agent.dll
Syntax
public sealed class TaskCollection : Collection<ITask>, IList<ITask>, ICollection<ITask>, IList, ICollection, IReadOnlyList<ITask>, IReadOnlyCollection<ITask>, IEnumerable<ITask>, IEnumerable, IValidator, IDisposable
Constructors
TaskCollection()
Declaration
public TaskCollection()
Properties
ErrorMessage
Gets the message indicating the errors found during validation process.
Declaration
public string ErrorMessage { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Dispose()
Disposes all service tasks in the collection.
Declaration
public void Dispose()
Finalize()
Calls Dispose.
Declaration
protected void Finalize()
ReadConfiguration()
Reads service tasks configuration from the current application configuration file.
Declaration
public void ReadConfiguration()
ReadConfiguration(Configuration)
Reads tasks configuration from provided configuration file.
Declaration
public void ReadConfiguration(Configuration configuration)
Parameters
Type | Name | Description |
---|---|---|
Configuration | configuration | Configuration file to read tasks from. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown, if |
ObjectDisposedException | Thrown, if this object has already been disposed. |
ConfigurationErrorsException | Thrown, if service task can not be created. |
StartAll(HostType)
Starts all tasks in the collection.
Declaration
public int StartAll(HostType hostType)
Parameters
Type | Name | Description |
---|---|---|
HostType | hostType | The type of host process where task is running. |
Returns
Type | Description |
---|---|
Int32 | The number of successfully started tasks. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | Thrown, if this object has already been disposed. |
StopAll()
Stops all tasks in the collection.
Declaration
public int StopAll()
Returns
Type | Description |
---|---|
Int32 | The number of successfully stopped tasks. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | Thrown, if this object has already been disposed. |
Validate()
Evaluates the state of all tasks in the collection.
Declaration
public bool Validate()
Returns
Type | Description |
---|---|
Boolean | True if state of all tasks is valid or collection is empty; otherwise, false. |
WriteConfiguration()
Writes service tasks configuration to the current application configuration file.
Declaration
public void WriteConfiguration()
WriteConfiguration(Configuration)
Writes configuration of all tasks in the collection to provided Configuration object.
Declaration
public void WriteConfiguration(Configuration configuration)
Parameters
Type | Name | Description |
---|---|---|
Configuration | configuration | Configuration object to write into. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown, if |
ObjectDisposedException | Thrown, if this object has already been disposed. |
ConfigurationErrorsException | Thrown, if task can not be created. |