| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.JSInterop;
- namespace EasyTemplate.Service
- {
- public class ModalHelper
- {
- private readonly string _modalId;
- private static IJSRuntime _jsRuntime;
- public static void Initialize(IJSRuntime jsRuntime)
- {
- _jsRuntime = jsRuntime;
- }
- public ModalHelper(string modalId)
- {
- _modalId = modalId;
- }
- public async void Show()
- {
- if (_jsRuntime != null)
- {
- await _jsRuntime.InvokeVoidAsync("eval", $"$('#{_modalId}').modal('show')");
- }
- }
- public async void Hide()
- {
- if (_jsRuntime != null)
- {
- await _jsRuntime.InvokeVoidAsync("eval", $"$('#{_modalId}').modal('hide')");
- }
- }
- }
- }
|