@inject ISnackbar snackbar @if (processing) { Processing } else { Ok } Cancel @code { [CascadingParameter] MudDialogInstance MudDialog { get; set; } [Parameter] public string comments { get; set; } = ""; private string[] errors = { }; private bool processing = false; protected override void OnParametersSet() { comments = string.Empty; } private void SubmitComments() { processing = true; try { if (string.IsNullOrWhiteSpace(comments) || comments.Length < 5) throw new Exception("Comments must be at least five characters long"); MudDialog.Close(DialogResult.Ok(comments)); } catch (Exception ex) { snackbar.Add(ex.Message, Severity.Error); } processing = false; } private void Cancel() { MudDialog.Close(DialogResult.Cancel()); } }