Table of Contents

Class TwDialogReference

Namespace
TwBlazor.Services
Assembly
TwBlazor.dll

Default implementation of ITwDialogReference.

public class TwDialogReference : ITwDialogReference
Inheritance
TwDialogReference
Implements
Inherited Members

Constructors

TwDialogReference(Guid, ITwDialogService)

Initializes a new instance of the TwDialogReference class.

public TwDialogReference(Guid id, ITwDialogService dialogService)

Parameters

id Guid

The unique identifier of the dialog.

dialogService ITwDialogService

The service used to close the dialog.

Properties

Dialog

Gets the dialog content component instance, once rendered.

public object? Dialog { get; }

Property Value

object

Id

Gets the unique identifier of this dialog.

public Guid Id { get; }

Property Value

Guid

Options

Gets the options used to display this dialog.

public TwDialogOptions? Options { get; }

Property Value

TwDialogOptions

RenderCompleteTaskCompletionSource

Gets a task source that completes once the dialog has rendered for the first time.

public TaskCompletionSource<bool> RenderCompleteTaskCompletionSource { get; }

Property Value

TaskCompletionSource<bool>

RenderFragment

Gets or sets the rendered content of the dialog.

public RenderFragment? RenderFragment { get; set; }

Property Value

RenderFragment

Result

Gets a task that completes with the result once the dialog closes.

public Task<TwDialogResult?> Result { get; }

Property Value

Task<TwDialogResult>

Title

Gets the title displayed in the dialog header.

public string? Title { get; }

Property Value

string

Methods

Close()

Closes the dialog with a successful, empty result.

public void Close()

Close(TwDialogResult?)

Closes the dialog with the specified result.

public void Close(TwDialogResult? result)

Parameters

result TwDialogResult

The result to complete Result with.

Dismiss(TwDialogResult?)

Marks the dialog as dismissed, completing Result.

public virtual bool Dismiss(TwDialogResult? result)

Parameters

result TwDialogResult

The result to complete Result with.

Returns

bool

true if this call set the result; false if it was already set.

GetReturnValueAsync<T>()

Gets the result data cast to T, once the dialog closes.

public Task<T?> GetReturnValueAsync<T>()

Returns

Task<T>

Type Parameters

T

The expected type of the returned data.

InjectDialog(object)

Assigns the dialog content component instance.

public void InjectDialog(object instance)

Parameters

instance object

The rendered dialog content component.

InjectOptions(TwDialogOptions)

Assigns the options used to display this dialog.

public void InjectOptions(TwDialogOptions options)

Parameters

options TwDialogOptions

The options to use.

InjectRenderFragment(RenderFragment)

Replaces the rendered content of the dialog.

public void InjectRenderFragment(RenderFragment renderFragment)

Parameters

renderFragment RenderFragment

The new content to render.

InjectTitle(string?)

Assigns the title displayed in the dialog header.

public void InjectTitle(string? title)

Parameters

title string

The title to display.