XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.WinUIHelper

【DLL】WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目

公开
关注 0 Fork 0 Star 0
UTF-8
namespace XFEExtension.NetCore.WinUIHelper.Interface.Services;

/// <summary>
/// 对话框弹出服务
/// </summary>
public interface IDialogService
{
    /// <summary>
    /// 对话框字典
    /// </summary>
    Dictionary<string, ContentDialog> DialogDictionary { get; }
    /// <summary>
    /// 注册对话框控件
    /// </summary>
    /// <param name="contentDialog">对话框控件</param>
    bool RegisterDialog(ContentDialog contentDialog) => DialogDictionary.TryAdd(contentDialog.Name, contentDialog);
    /// <summary>
    /// 显示一个对话框
    /// </summary>
    /// <param name="dialogName">需要显示的对话框名称</param>
    /// <returns>对话框返回结果(异步)</returns>
    async Task<ContentDialogResult> ShowDialog(string dialogName) => await DialogDictionary[dialogName].ShowAsync();
}