Show / Hide Table of Contents

Interface ITask

Represents an operation that can be cancelled and have its progress tracked.

Namespace: NanoByte.Common.Tasks
Assembly: NanoByte.Common.dll
Syntax
public interface ITask

Properties

CanCancel

Indicates whether this task can be canceled once it has been started.

Declaration
bool CanCancel { get; }
Property Value
Type Description
Boolean

Name

A name describing the task in human-readable form.

Declaration
string Name { get; }
Property Value
Type Description
String

Tag

An object used to associate the task with a specific process; can be null.

Declaration
object Tag { get; set; }
Property Value
Type Description
Object

Methods

Run(CancellationToken, ICredentialProvider, IProgress<TaskSnapshot>)

Runs the task and blocks until it is complete.

Declaration
void Run(CancellationToken cancellationToken = null, ICredentialProvider credentialProvider = null, IProgress<TaskSnapshot> progress = null)
Parameters
Type Name Description
CancellationToken cancellationToken

Used to receive a signal (e.g. from another thread) when the user wants to cancel the task.

ICredentialProvider credentialProvider

Object used to retrieve credentials for specific Uris on demand; can be null.

IProgress<TaskSnapshot> progress

Used to report back the task's progress (e.g. to another thread).

Exceptions
Type Condition
OperationCanceledException

The task was canceled from another thread.

IOException

The task ended with IOError.

WebException

The task ended with WebError.

See Also
RunTask(ITask)

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)

See Also

ITaskHandler
In This Article
Back to top Copyright Bastian Eicher