NanoByte.Common 2.10.6
NanoByte.Common.Tasks.ITask Interface Reference

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

Inheritance diagram for NanoByte.Common.Tasks.ITask:
NanoByte.Common.Tasks.TaskBase NanoByte.Common.Net.DownloadFile NanoByte.Common.Storage.ReadDirectoryBase NanoByte.Common.Storage.ReadFile NanoByte.Common.Tasks.ForEachTask< T > NanoByte.Common.Tasks.SimplePercentTask NanoByte.Common.Tasks.SimpleTask NanoByte.Common.Threading.WaitTask NanoByte.Common.Storage.CopyDirectory NanoByte.Common.Storage.MoveDirectory

Public Member Functions

void Run (CancellationToken cancellationToken=default, ICredentialProvider? credentialProvider=null, IProgress< TaskSnapshot >? progress=null)
 Runs the task and blocks until it is complete. More...


string Name [get]
 A name describing the task in human-readable form.
object? Tag [getset]
 An object used to associate the task with a specific process; can be null.
bool CanCancel [get]
 Indicates whether this task can be canceled once it has been started.

Detailed Description

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

See also

Member Function Documentation

◆ Run()

void NanoByte.Common.Tasks.ITask.Run ( CancellationToken  cancellationToken = default,
ICredentialProvider credentialProvider = null,
IProgress< TaskSnapshot >?  progress = null 

Runs the task and blocks until it is complete.

cancellationTokenUsed to receive a signal (e.g. from another thread) when the user wishes to cancel the task.
credentialProviderObject used to retrieve credentials for specific Uris on demand; can be null.
progressUsed to report back the task's progress (e.g. to another thread).
OperationCanceledExceptionThe task was canceled from another thread.
IOExceptionThe task ended with TaskState.IOError.
WebExceptionThe task ended with TaskState.WebError.
See also

Implemented in NanoByte.Common.Tasks.TaskBase.

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