public DefaultToastModel(string?text, ToastIcon icon, IEnumerable <ToastButton>?buttons, bool stacked) { Icon = icon; Text = text; Stacked = stacked; Buttons = buttons?.ToArray() ?? Array.Empty <ToastButton>(); }
protected virtual Task ShowToastAsync(object context, ToastIcon icon, string message, string title) { try { var js = (context as IHasJSRuntime)?.JS; return(js?.ShowToastAsync(new ToastOptions { Text = message, Icon = icon, Position = ToastPosition.BottomCenter, ShowLoader = false, }).AsTask() ?? Task.CompletedTask); } catch { } return(default);
public static void ShowToast(this IToastService service, string?text, ToastIcon icon, IEnumerable <ToastButton>?buttons) { service.Show(new DefaultToastModel(text, icon, buttons, false)); }
public static void ShowToast(this IToastService service, string?text, ToastIcon icon, IEnumerable <ToastButton>?buttons, bool stacked, int displayTime) { service.Show(new DefaultToastModel(text, icon, buttons, stacked), displayTime); }
public static void ShowToast(this IToastService service, string?text, ToastIcon icon, int displayTime) { service.Show(new DefaultToastModel(text, icon, null, false), displayTime); }