Table of Contents

Class TaskHandlerExtensions

Namespace
NanoByte.Common.Tasks
Assembly
NanoByte.Common.dll

Extension methods for ITaskHandler

public static class TaskHandlerExtensions
Inheritance
object
TaskHandlerExtensions

Methods

OutputLow(ITaskHandler, string, string)

Displays multi-line text to the user unless Verbosity is Batch.

public static void OutputLow(this ITaskHandler handler, string title, string message)

Parameters

handler ITaskHandler

The underlying ITaskHandler.

title string

A title for the message.

message string

The string to display.

Remarks

Implementations may close the UI as a side effect. Therefore this should be your last call on the handler.

OutputLow<T>(ITaskHandler, string, NamedCollection<T>)

Displays tree-like data to the user unless Verbosity is Batch.

public static void OutputLow<T>(this ITaskHandler handler, string title, NamedCollection<T> data) where T : INamed

Parameters

handler ITaskHandler

The underlying ITaskHandler.

title string

A title for the data.INamed

data NamedCollection<T>

The data to display.

Type Parameters

T

Remarks

Implementations may close the UI as a side effect. Therefore this should be your last call on the handler.

OutputLow<T>(ITaskHandler, string, IEnumerable<T>)

Displays tabular data to the user unless Verbosity is Batch.

public static void OutputLow<T>(this ITaskHandler handler, string title, IEnumerable<T> data)

Parameters

handler ITaskHandler

The underlying ITaskHandler.

title string

A title for the data.

data IEnumerable<T>

The data to display.

Type Parameters

T

Remarks

Implementations may close the UI as a side effect. Therefore this should be your last call on the handler.

RunTaskAndReturn<T>(ITaskHandler, ResultTask<T>)

Runs an IResultTask<T> and returns it's result once it has been completed.

public static T RunTaskAndReturn<T>(this ITaskHandler handler, ResultTask<T> task)

Parameters

handler ITaskHandler

The task handler.

task ResultTask<T>

The task to be run. (Run(CancellationToken, ICredentialProvider?, IProgress<TaskSnapshot>?) or equivalent is called on it.)

Returns

T

The Result.

Type Parameters

T

Exceptions

OperationCanceledException

The user canceled the task.

IOException

The task ended with IOError.

WebException

The task ended with WebError.