Class TwDialogReference
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
idGuidThe unique identifier of the dialog.
dialogServiceITwDialogServiceThe service used to close the dialog.
Properties
Dialog
Gets the dialog content component instance, once rendered.
public object? Dialog { get; }
Property Value
Id
Gets the unique identifier of this dialog.
public Guid Id { get; }
Property Value
Options
Gets the options used to display this dialog.
public TwDialogOptions? Options { get; }
Property Value
RenderCompleteTaskCompletionSource
Gets a task source that completes once the dialog has rendered for the first time.
public TaskCompletionSource<bool> RenderCompleteTaskCompletionSource { get; }
Property Value
RenderFragment
Gets or sets the rendered content of the dialog.
public RenderFragment? RenderFragment { get; set; }
Property Value
Result
Gets a task that completes with the result once the dialog closes.
public Task<TwDialogResult?> Result { get; }
Property Value
Title
Gets the title displayed in the dialog header.
public string? Title { get; }
Property Value
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
resultTwDialogResultThe result to complete Result with.
Dismiss(TwDialogResult?)
Marks the dialog as dismissed, completing Result.
public virtual bool Dismiss(TwDialogResult? result)
Parameters
resultTwDialogResultThe result to complete Result with.
Returns
- bool
trueif this call set the result;falseif 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
TThe expected type of the returned data.
InjectDialog(object)
Assigns the dialog content component instance.
public void InjectDialog(object instance)
Parameters
instanceobjectThe rendered dialog content component.
InjectOptions(TwDialogOptions)
Assigns the options used to display this dialog.
public void InjectOptions(TwDialogOptions options)
Parameters
optionsTwDialogOptionsThe options to use.
InjectRenderFragment(RenderFragment)
Replaces the rendered content of the dialog.
public void InjectRenderFragment(RenderFragment renderFragment)
Parameters
renderFragmentRenderFragmentThe new content to render.
InjectTitle(string?)
Assigns the title displayed in the dialog header.
public void InjectTitle(string? title)
Parameters
titlestringThe title to display.