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...
 

Properties

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
ITaskHandler

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.

Parameters
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).
Exceptions
OperationCanceledExceptionThe task was canceled from another thread.
IOExceptionThe task ended with TaskState.IOError.
WebExceptionThe task ended with TaskState.WebError.
See also
ITaskHandler.RunTask

Implemented in NanoByte.Common.Tasks.TaskBase.


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