public static async ValueTask <T?> SelectItem <T>(
            this IApplicationDialog dialog,
            T[] values,
            Func <T, string> formatter,
            int selected = -1,
            string?title = null)
        {
            var items  = values.Select(formatter).ToArray();
            var result = await dialog.Select(items, selected, title);

            return(result >= 0 ? values[result] : default);
        public static ValueTask <int> Select <T>(
            this IApplicationDialog dialog,
            T[] values,
            Func <T, string> formatter,
            int selected = -1,
            string?title = null)
        {
            var items = values.Select(formatter).ToArray();

            return(dialog.Select(items, selected, title));
        }
 public DialogMenuViewModel(
     ApplicationState applicationState,
     IApplicationDialog dialog)
     : base(applicationState)
 {
     InformationCommand = MakeAsyncCommand(async() =>
     {
         await dialog.Information("message");
     });
     ConfirmCommand = MakeAsyncCommand(async() =>
     {
         var ret = await dialog.Confirm("message");
         await dialog.Information($"result=[{ret}]");
     });
     SelectCommand = MakeAsyncCommand(async() =>
     {
         selected = await dialog.Select(Enumerable.Range(1, 15).Select(x => $"Item-{x}").ToArray(), selected);
         await dialog.Information($"result=[{selected}]");
     });
 }