You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/src/Connected.Components/Services/ModalDialogService.cs

36 lines
971 B

using Connected.Models.Modal;
using Microsoft.AspNetCore.Components;
using System.ComponentModel;
namespace Connected.Services;
public class ModalDialogService
{
public event Action<string, RenderFragment, List<ModalButton>, ModalOptions> OnShow;
public event Action OnClose;
public void ShowDialog(string title, RenderFragment Content, List<ModalButton> buttons, ModalOptions options)
{
var body = Content;
OnShow?.Invoke(title, body, buttons, options);
}
public void ShowDialog(string title, MarkupString content, List<ModalButton> buttons, ModalOptions options)
{
var body = new RenderFragment(x => x.AddContent(1, content));
OnShow?.Invoke(title, body, buttons, options);
}
public void ShowDialog(string title, MarkupString content, List<ModalButton> buttons)
{
var body = new RenderFragment(x => x.AddContent(1, content));
OnShow?.Invoke(title, body, buttons, new ModalOptions());
}
public void Close()
{
OnClose?.Invoke();
}
}