NanoByte.Common  2.8.1
NanoByte.Common.Tasks.CliTaskHandler Class Reference

Informs the user about the progress of tasks and ask questions using console output. More...

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

Public Member Functions

 CliTaskHandler ()
 Creates a new CLI task handler. Registers a Log.Handler. More...
 
override void Dispose ()
 Unregisters the Log.Handler. More...
 
override 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.
 
override void Output (string title, string message)
 Displays multi-line text to the user.
 
override void Error (Exception exception)
 Displays an error message to the user.
 
- Public Member Functions inherited from NanoByte.Common.Tasks.TaskHandlerBase
bool Ask (string question, bool? defaultAnswer=null, string? alternateMessage=null)
 Asks the user a Yes/No/Cancel question.
 
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.
 
- Public Member Functions inherited from NanoByte.Common.MarshalNoTimeout
override? object InitializeLifetimeService ()
 

Protected Member Functions

virtual void LogHandler (LogSeverity severity, string message)
 Prints Log messages to the Console based on their LogSeverity and the current Verbosity level. More...
 
override bool AskInteractive (string question, bool defaultAnswer)
 Asks the user a Yes/No/Cancel question.
 

Properties

override? ICredentialProvider CredentialProvider [get]
 
override bool IsInteractive [get]
 
- Properties inherited from NanoByte.Common.Tasks.TaskHandlerBase
CancellationTokenSource CancellationTokenSource = new() [get]
 Used to signal the CancellationToken. More...
 
CancellationToken CancellationToken [get]
 
virtual ? ICredentialProvider CredentialProvider [get]
 
Verbosity Verbosity [get, set]
 
virtual bool IsInteractive [get]
 Indicates whether the user can provide input. More...
 
- 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

Informs the user about the progress of tasks and ask questions using console output.

Constructor & Destructor Documentation

◆ CliTaskHandler()

NanoByte.Common.Tasks.CliTaskHandler.CliTaskHandler ( )
inline

Creates a new CLI task handler. Registers a Log.Handler.

Member Function Documentation

◆ Dispose()

override void NanoByte.Common.Tasks.CliTaskHandler.Dispose ( )
inlinevirtual

Unregisters the Log.Handler.

Reimplemented from NanoByte.Common.Tasks.TaskHandlerBase.

Reimplemented in NanoByte.Common.Tasks.AnsiCliTaskHandler.

◆ LogHandler()

virtual void NanoByte.Common.Tasks.CliTaskHandler.LogHandler ( LogSeverity  severity,
string  message 
)
inlineprotectedvirtual

Prints Log messages to the Console based on their LogSeverity and the current Verbosity level.

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

Reimplemented in NanoByte.Common.Tasks.AnsiCliTaskHandler.


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