Interface ITwDialogService
Shows and closes dialogs rendered through TwDialog from C# code.
public interface ITwDialogService
Remarks
This service requires a TwDialogProvider in the active render tree, typically placed once in your layout.
Methods
Close(ITwDialogReference)
Closes the specified dialog with a successful, empty result.
void Close(ITwDialogReference dialog)
Parameters
dialogITwDialogReferenceThe reference of the dialog to close.
Close(ITwDialogReference, TwDialogResult?)
Closes the specified dialog with the given result.
void Close(ITwDialogReference dialog, TwDialogResult? result)
Parameters
dialogITwDialogReferenceThe reference of the dialog to close.
resultTwDialogResultThe result to include.
CreateReference()
Creates a dialog reference without showing it.
ITwDialogReference CreateReference()
Returns
- ITwDialogReference
The created dialog reference.
ShowAsync(Type)
Displays a dialog for the specified component type.
Task<ITwDialogReference> ShowAsync(Type component)
Parameters
componentTypeThe 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.
Task<ITwDialogReference> ShowAsync(Type component, string? title)
Parameters
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.
Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogOptions options)
Parameters
componentTypeThe dialog content to display.
titlestringThe text at the top of the dialog.
optionsTwDialogOptionsThe 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.
Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters)
Parameters
componentTypeThe dialog content to display.
titlestringThe text at the top of the dialog.
parametersTwDialogParametersThe 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.
Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters, TwDialogOptions options)
Parameters
componentTypeThe dialog content to display.
titlestringThe text at the top of the dialog.
parametersTwDialogParametersThe custom parameters to set on the dialog content.
optionsTwDialogOptionsThe custom display options for the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
ShowAsync<TComponent>()
Displays a dialog.
Task<ITwDialogReference> ShowAsync<TComponent>() where TComponent : IComponent
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(string?)
Displays a dialog with a custom title.
Task<ITwDialogReference> ShowAsync<TComponent>(string? title) where TComponent : IComponent
Parameters
titlestringThe text at the top of the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(string?, TwDialogOptions)
Displays a dialog with a custom title and options.
Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogOptions options) where TComponent : IComponent
Parameters
titlestringThe text at the top of the dialog.
optionsTwDialogOptionsThe custom display options for the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(string?, TwDialogParameters)
Displays a dialog with a custom title and parameters.
Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters) where TComponent : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersTwDialogParametersThe custom parameters to set on the dialog content.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(string?, TwDialogParameters, TwDialogOptions?)
Displays a dialog with a custom title, parameters, and options.
Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters, TwDialogOptions? options) where TComponent : IComponent
Parameters
titlestringThe text at the top of the dialog.
parametersTwDialogParametersThe custom parameters to set on the dialog content.
optionsTwDialogOptionsThe custom display options for the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(TwDialogOptions)
Displays a dialog with options.
Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogOptions options) where TComponent : IComponent
Parameters
optionsTwDialogOptionsThe custom display options for the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(TwDialogParameters)
Displays a dialog with parameters.
Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters) where TComponent : IComponent
Parameters
parametersTwDialogParametersThe custom parameters to set on the dialog content.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
ShowAsync<TComponent>(TwDialogParameters, TwDialogOptions)
Displays a dialog with parameters and options.
Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters, TwDialogOptions options) where TComponent : IComponent
Parameters
parametersTwDialogParametersThe custom parameters to set on the dialog content.
optionsTwDialogOptionsThe custom display options for the dialog.
Returns
- Task<ITwDialogReference>
A reference to the dialog.
Type Parameters
TComponentThe dialog content to display.
Events
DialogInstanceAddedAsync
Occurs when a new dialog instance is created and needs to be rendered.
event Func<ITwDialogReference, Task>? DialogInstanceAddedAsync
Event Type
OnDialogCloseRequested
Occurs when a request is made to close a dialog.
event Action<ITwDialogReference, TwDialogResult?>? OnDialogCloseRequested