Exemple #1
0
        protected async Task ButtonClickAsync(object?customData = null)
        {
            if (Model.RequiresValidForm && !(EditContext?.IsValid() ?? true))
            {
                return;
            }

            if (!Model.ShouldConfirm || await JsRuntime.InvokeAsync <bool>("confirm", LanguageResolver.ResolveText("Are you sure?")))
            {
                Model.NotifyClick(EditContext, customData);
            }
        }
Exemple #2
0
        protected async Task ButtonClickAsync(object?customData = null)
        {
            try
            {
                IsDisabled = true;
                StateHasChanged();

                if (Model.RequiresValidForm && (EditContext == null || !await EditContext.IsValidAsync()))
                {
                    return;
                }

                if (!Model.ShouldConfirm || await JsRuntime.InvokeAsync <bool>("confirm", LanguageResolver.ResolveText("Are you sure?")))
                {
                    await Model.NotifyClickAsync(EditContext !, customData);
                }
            }
            finally
            {
                IsDisabled = false;
                StateHasChanged();
            }
        }