Update the 'IDialogService.CloseAsync' methods to accept an IDialogReference interface instead of the concrete DialogReference class.#4316
Conversation
…ference interace instead of the concrete DialogReference class.
|
I'm not opposed to this, but can you elaborate on what we gain from it? |
|
As mentioned in the description, when you use one of the methods to create a reference to a dialog (e.g. var dialogReference = _dialogService.ShowDialog(...);
// Not type safe and could be false and cause an error
_dialogService.CloseDialog(dialogReference as DialogReference)OR var dialogReference = _dialogService.ShowDialog(...);
if(dialogReference is DialogReference realDialogReference)
{
_dialogService.CloseDialog(realDialogReference);
}Either way... the methods should be consistent in what type they return and accept (unless of course there is a good reason for it which doesn't appear to be the case in this instance). You could change the |
Pull Request
📖 Description
The methods on the
IDialogServiceinterface that create a reference to a dialog (ShowDialog, ShowPanel etc) all return anIDialogReferenceinterface. However, theCloseAsyncmethod accepts aDialogReferenceconcrete type instead of the interface. It makes sense to me that theCloseAsyncmethods should accept the interface as well.✅ Checklist
General
Component-specific