Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

39 wiersze
1.1 KiB

  1. using CurrieTechnologies.Razor.SweetAlert2;
  2. namespace AbrBlazorTools;
  3. public static class SwalExtensions
  4. {
  5. public static async Task<SweetAlertResult> ShowToast(this SweetAlertService service, string message)
  6. {
  7. return await service.FireAsync(
  8. new SweetAlertOptions
  9. {
  10. Toast = true,
  11. Text = message,
  12. Timer = 5000
  13. });
  14. }
  15. public static async Task<SweetAlertResult> ShowSwal(this SweetAlertService service, string title, string message, SweetAlertIcon icon)
  16. {
  17. if (icon == SweetAlertIcon.Question)
  18. return await service.FireAsync(new SweetAlertOptions
  19. {
  20. ConfirmButtonText="Yes",
  21. ShowConfirmButton = true,
  22. ShowDenyButton = true,
  23. ShowCloseButton = false,
  24. Html = message,
  25. Icon = icon,
  26. Title = title,
  27. });
  28. return await service.FireAsync(new SweetAlertOptions
  29. {
  30. Html = message,
  31. Icon = icon,
  32. Title = title,
  33. });
  34. }
  35. }