Files
Needlework.Net/Needlework.Net/Services/DialogService.cs
2024-08-18 22:10:04 -05:00

21 lines
467 B
C#

using FluentAvalonia.UI.Controls;
using System;
using System.Threading.Tasks;
namespace Needlework.Net.Services
{
public class DialogService
{
public async Task<ContentDialogResult> ShowAsync<T>(object data)
where T : IDialog, IDisposable
{
T dialog = Activator.CreateInstance<T>();
var result = await dialog.ShowAsync(data);
dialog.Dispose();
return result;
}
}
}