Allow pass onClose to Show method
See original GitHub issueI’d like to pass onClose to Show method like win forms show dialog
It will free programmers from handle subscribe/unsubscribe.
Also it useful if any error was thown before unsubscribe
Look like that:
Modal.Show<MessageDialog>("Dance", parameters, onClose: ShowResult);
I have prepared branch with this feature , but I can not push it, seems I have not rights.
If you give me right, I will prepare pull request with feature and samples
Also I fixed bug (m.b blazor bug) If I show first modal then in onClose I show second modal with the same component type (but with another text), blazor do not refresh content inside modal window
Like this:
Modal.Show<MessageDialog>("Dance", parameters, onClose: ShowResult);
then
void ShowResult(ModalResult result)
{
var parameters = new ModalParameters();
parameters.Add("DialogParameters", new MessageDialog.DialogParameters()
{
Message = result.Cancelled ? "User calcel process" : result.Data.ToString(),
Buttons = new MessageDialog.ButtonType[] { MessageDialog.ButtonType.Ok }
});
Modal.Show<MessageDialog>("Result", parameters);
}
to fix that in ModelService I made :
var content = new RenderFragment(x => { x.OpenComponent(1, componentType); x.SetKey(Guid.NewGuid()); x.CloseComponent(); });
I added x.SetKey when build render fragment
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
That’s because you are trying to push directly to the repo and not raising a PR.
You have to fork the repo first and then raise a PR from your fork into this repo. Again, please have a read of the GitHub docs, here is a link to the article on forking.
Yes, If you can implement this API with awaitable result, it will resolve the problem too