|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using CurrieTechnologies.Razor.SweetAlert2;
-
- namespace BlazorPages.Tools
- {
- public class SwalUtils : ISwalUtils
- {
- private readonly SweetAlertService _service;
- public SwalUtils(SweetAlertService service)
- {
- _service = service;
- }
-
- public async Task<SweetAlertResult> ShowToast(string message)
- {
- return await _service.FireAsync(
- new SweetAlertOptions
- {
- Toast = true,
- Text = message,
- Timer = 5000,
- ConfirmButtonText = "خُب"
- });
- }
-
-
- public async Task<SweetAlertResult> ShowSwal(string title, string message, SweetAlertIcon icon)
- {
- if (icon == SweetAlertIcon.Question)
- return await _service.FireAsync(new SweetAlertOptions
- {
- ShowConfirmButton = true,
- CancelButtonColor = "Red",
- ShowCloseButton = false,
- ShowCancelButton = true,
- Html = message,
- Icon = icon,
- Title = title,
- CancelButtonText = "انصراف",
- ConfirmButtonText = "تائید"
- });
- return await _service.FireAsync(new SweetAlertOptions
- {
- ShowConfirmButton = false,
- ShowCloseButton = false,
- ShowCancelButton = true,
- Html = message,
- Icon = icon,
- Title = title,
- CancelButtonText = "خًب"
- });
- }
- }
-
- }
-
|