NanoByte.Common  2.9.0
NanoByte.Common.Tasks.ServiceTaskHandler Class Reference

Uses ILogger<TCategoryName>, ICredentialProvider and CancellationTokenSource from

See also
IServiceProvider

if available. Executes tasks silently and suppresses any questions. More...

Inheritance diagram for NanoByte.Common.Tasks.ServiceTaskHandler:
NanoByte.Common.Tasks.SilentTaskHandler NanoByte.Common.Tasks.TaskHandlerBase NanoByte.Common.Tasks.ITaskHandler

Public Member Functions

 ServiceTaskHandler (IServiceProvider provider)
 Creates a new service task handler. Registers a Log.Handler if provider provides ILogger<TCategoryName>. More...
 
override void Dispose ()
 Unregisters the Log.Handler. More...
 
- Public Member Functions inherited from NanoByte.Common.Tasks.SilentTaskHandler
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
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.
 
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.
 

Properties

override? ICredentialProvider CredentialProvider [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...
 

Additional Inherited Members

- Protected Member Functions inherited from NanoByte.Common.Tasks.SilentTaskHandler
override bool AskInteractive (string question, bool defaultAnswer)
 Always returns defaultAnswer . More...
 

Detailed Description

Uses ILogger<TCategoryName>, ICredentialProvider and CancellationTokenSource from

See also
IServiceProvider

if available. Executes tasks silently and suppresses any questions.

See also
ConfigurationCredentialProviderRegistration.ConfigureCredentials

Constructor & Destructor Documentation

◆ ServiceTaskHandler()

NanoByte.Common.Tasks.ServiceTaskHandler.ServiceTaskHandler ( IServiceProvider  provider)
inline

Creates a new service task handler. Registers a Log.Handler if provider provides ILogger<TCategoryName>.

Parameters
providerThe DI container to check for ILogger<TCategoryName>, ICredentialProvider and CancellationTokenSource.

Member Function Documentation

◆ Dispose()

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

Unregisters the Log.Handler.

Reimplemented from NanoByte.Common.Tasks.TaskHandlerBase.


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