NanoByte.Common  2.6.1
NanoByte.Common.Tasks.TaskHandlerBase Class Referenceabstract

Common base class for ITaskHandler implementations. More...

Inheritance diagram for NanoByte.Common.Tasks.TaskHandlerBase:
NanoByte.Common.MarshalNoTimeout NanoByte.Common.Tasks.ITaskHandler NanoByte.Common.Tasks.CliTaskHandler NanoByte.Common.Tasks.GuiTaskHandlerBase NanoByte.Common.Tasks.DialogTaskHandler

Public Member Functions

virtual void Dispose ()
virtual void RunTask (ITask task)
 Runs an ITask and tracks its progress. Returns once the task has been completed. The task may be executed on a different thread.
abstract bool Ask (string question, bool? defaultAnswer=null, string? alternateMessage=null)
 Asks the user a Yes/No/Cancel question.
abstract void Output (string title, string message)
 Displays multi-line text to the user.
virtual void Output< T > (string title, IEnumerable< T > data)
 Displays tabular data to the user.
virtual void Output< T > (string title, NamedCollection< T > data)
 Displays tree-like data to the user.
abstract void Error (Exception exception)
 Displays an error message to the user.
- Public Member Functions inherited from NanoByte.Common.MarshalNoTimeout
override? object InitializeLifetimeService ()

Protected Member Functions

 TaskHandlerBase ()
 Starts handling log events. More...
abstract void LogHandler (LogSeverity severity, string message)
 Reports Log messages to the user based on their LogSeverity and the current Verbosity level. More...

Protected Attributes

readonly CancellationTokenSource CancellationTokenSource = new()
 Used to signal the CancellationToken. More...


CancellationToken CancellationToken [get]
abstract ? ICredentialProvider CredentialProvider [get]
Verbosity Verbosity [get, set]
- Properties inherited from NanoByte.Common.Tasks.ITaskHandler
CancellationToken CancellationToken [get]
 Used to signal when the user wishes to cancel the entire current process (and any ITasks it includes). More...
ICredentialProviderCredentialProvider [get]
 Used to ask the user or a keyring for NetworkCredentials for specific Uris; can be null. More...
Verbosity Verbosity [get, set]
 The detail level of messages displayed to the user. More...

Detailed Description

Common base class for ITaskHandler implementations.

Constructor & Destructor Documentation

◆ TaskHandlerBase()

NanoByte.Common.Tasks.TaskHandlerBase.TaskHandlerBase ( )

Starts handling log events.

Member Function Documentation

◆ LogHandler()

abstract void NanoByte.Common.Tasks.TaskHandlerBase.LogHandler ( LogSeverity  severity,
string  message 
protectedpure virtual

Reports Log messages to the user based on their LogSeverity and the current Verbosity level.

severityThe type/severity of the entry.
messageThe message text of the entry.

Implemented in NanoByte.Common.Tasks.CliTaskHandler, and NanoByte.Common.Tasks.GuiTaskHandlerBase.

Member Data Documentation

◆ CancellationTokenSource

readonly CancellationTokenSource NanoByte.Common.Tasks.TaskHandlerBase.CancellationTokenSource = new()

Used to signal the CancellationToken.

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