public void Close(Exception exception) { ModalDialogModel closingDialogWindow = _dialogs.Pop(); closingDialogWindow.TaskSource.SetException(exception); OnChanged(); }
public void Close(bool success, ModalDialogParameters returnParameters) { returnParameters = returnParameters ?? new ModalDialogParameters(); ModalDialogModel closingDialogWindow = _dialogs.Pop(); closingDialogWindow.TaskSource.SetResult(new ModalDialogResult(success, returnParameters)); OnChanged(); }
public Task <ModalDialogResult> ShowDialogAsync(Type dialogComponentType, string title, ModalDialogOptions options, ModalDialogParameters parameters) { if (!typeof(ComponentBase).IsAssignableFrom(dialogComponentType)) { throw new ArgumentException($"{dialogComponentType.FullName} must be a Blazor Component"); } parameters = parameters ?? new ModalDialogParameters(); options = options ?? new ModalDialogOptions(); ModalDialogModel newDialogWindow = new ModalDialogModel(dialogComponentType, title, parameters, options); _dialogs.Push(newDialogWindow); OnChanged(); return(newDialogWindow.Task); }