It takes two parts to use RfDialogManager.
First the page will need to have an
<RfDialogManager />
registered somewhere that isn't inside of a overflow hidden element.
Pererrabley it should be as high up the DOM tree to ensure some CSS rule doesn't affect it.
Secondly, the page will need to inject RForgeBlazor.Services.IDialogManager.cs.
This interface is used to communicate between RfDialogManager and the page.
This interface supports several overloads for each alert, confirm, and prompt.
NOTE: In projects that use rendermode: InteractiveServer.
The backend may take advantage of IDialogManagerBackend.cs.
I caution on using this. This should only be done if you are sure the project won't switch over to WASM.
Standard Request Flow
The RfDialogManager works off calling RForgeBlazor.Services.IDialogManager.cs and providing the method a callback function when completed.
Failing Callbacks
The callback you pass to Alert, Confirm, Prompt, or
MultiAction runs when the user answers. If it throws, or if you supplied none for an action
the user takes, the exception reaches your code instead of disappearing, and the dialog still closes
cleanly: the loading state clears and the next queued dialog is shown, so one bad callback never freezes
the dialog host. Handle errors inside your callback if the user should see a message.
Dialog Host Lifetime
Each RfDialogManager registers itself as the live dialog host when it starts, and the injected
IDialogManager service always routes Alert, Confirm, Prompt,
and MultiAction calls to the most recently registered host. The recommended setup is exactly one
host placed high in the layout that lives for the life of the app. In that setup there is nothing to manage.
When the host does move, the newest instance always wins. If one RfDialogManager replaces another,
for example during a layout or render tree swap, the new host takes over immediately and a later dispose of the
replaced (stale) instance leaves the current registration untouched. Dialogs keep rendering through the live
host no matter when the old instance is cleaned up. Disposing the currently registered host does unregister it:
calls made after that point are queued and shown as soon as a new host registers.
Manual unregistration is unchanged. The no-argument Unregister() on IDialogManager
still clears the registration unconditionally, so custom IDialogManager implementations and code
that called it directly behave exactly as before. Only the library component's own cleanup changed: it now
unregisters with its own instance identity, and the swap safety above applies whenever the injected service is
the library's own DialogManager.