Table of Contents

Class TwDialogService

Namespace
TwBlazor.Services
Assembly
TwBlazor.dll

Default implementation of ITwDialogService.

public class TwDialogService : ITwDialogService
Inheritance
TwDialogService
Implements
Inherited Members

Remarks

Register a TwDialogProvider once in your layout so dialogs created here can render.

Constructors

TwDialogService()

public TwDialogService()

Methods

Close(ITwDialogReference)

Closes the specified dialog with a successful, empty result.

public void Close(ITwDialogReference dialog)

Parameters

dialog ITwDialogReference

The reference of the dialog to close.

Close(ITwDialogReference, TwDialogResult?)

Closes the specified dialog with the given result.

public virtual void Close(ITwDialogReference dialog, TwDialogResult? result)

Parameters

dialog ITwDialogReference

The reference of the dialog to close.

result TwDialogResult

The result to include.

CreateReference()

Creates a dialog reference without showing it.

public virtual ITwDialogReference CreateReference()

Returns

ITwDialogReference

The created dialog reference.

ShowAsync(Type)

Displays a dialog for the specified component type.

public Task<ITwDialogReference> ShowAsync(Type component)

Parameters

component Type

The dialog content to display.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?)

Displays a dialog for the specified component type with a custom title.

public Task<ITwDialogReference> ShowAsync(Type component, string? title)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogOptions)

Displays a dialog for the specified component type with a custom title and options.

public Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogOptions options)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogParameters)

Displays a dialog for the specified component type with a custom title and parameters.

public Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogParameters, TwDialogOptions)

Displays a dialog for the specified component type with a custom title, parameters, and options.

public Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters, TwDialogOptions options)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync<TComponent>()

Displays a dialog.

public Task<ITwDialogReference> ShowAsync<TComponent>() where TComponent : IComponent

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?)

Displays a dialog with a custom title.

public Task<ITwDialogReference> ShowAsync<TComponent>(string? title) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogOptions)

Displays a dialog with a custom title and options.

public Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogOptions options) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogParameters)

Displays a dialog with a custom title and parameters.

public Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogParameters, TwDialogOptions?)

Displays a dialog with a custom title, parameters, and options.

public Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters, TwDialogOptions? options) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogOptions)

Displays a dialog with options.

public Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogOptions options) where TComponent : IComponent

Parameters

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogParameters)

Displays a dialog with parameters.

public Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters) where TComponent : IComponent

Parameters

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogParameters, TwDialogOptions)

Displays a dialog with parameters and options.

public Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters, TwDialogOptions options) where TComponent : IComponent

Parameters

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

Events

DialogInstanceAddedAsync

Occurs when a new dialog instance is created and needs to be rendered.

public event Func<ITwDialogReference, Task>? DialogInstanceAddedAsync

Event Type

Func<ITwDialogReference, Task>

OnDialogCloseRequested

Occurs when a request is made to close a dialog.

public event Action<ITwDialogReference, TwDialogResult?>? OnDialogCloseRequested

Event Type

Action<ITwDialogReference, TwDialogResult>