Files @ 4778889395e8
Branch filter:

Location: ATITD-Tools/Desert-Paint-Codex/Util/DialogUtil.cs

Jason Maltzen
Change the displayed permeutation count to display using locale-specific number formatting (with comma / dot separators). Fix a crash when starting a new round of recipe generation after recipe generation completed during a previous run.
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using ReactiveUI;

namespace DesertPaintCodex.Util
{
    public static class DialogUtil
    {
        public static async Task ShowDialog<View, ViewModel, ReturnType>(
            InteractionContext<ViewModel, ReturnType> interaction) where View : Window, new()
        {
            if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
            {
                View       dialog = new() {DataContext = interaction.Input};
                ReturnType result = await dialog.ShowDialog<ReturnType>(desktop.MainWindow);
                interaction.SetOutput(result);
            }
        }
    }
}