private Task Show(SwalOption option) { IsAutoHide = option.IsAutoHide; Delay = option.Delay; option.Dialog = ModalContainer; var parameters = option.ToAttributes(); parameters.Add(nameof(ModalDialog.OnClose), new Func <Task>(async() => { if (IsAutoHide && DelayToken != null) { DelayToken.Cancel(); DelayToken = null; } DialogParameter = null; await ModalContainer.CloseOrPopDialog(); StateHasChanged(); })); parameters.Add(nameof(ModalDialog.BodyTemplate), BootstrapDynamicComponent.CreateComponent <SweetAlertBody>(SweetAlertBody.Parse(option)).Render()); DialogParameter = parameters; IsShowDialog = true; StateHasChanged(); return(Task.CompletedTask); }
/// <summary> /// /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (disposing) { if (DelayToken != null) { DelayToken.Cancel(); DelayToken.Dispose(); DelayToken = null; } SwalService.UnRegister(this); } }