using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml.Controls; using Toolkit.Foundation; namespace Toolkit.WinUI; public static class IServiceCollectionExtensions { public static IServiceCollection AddWinUI(this IServiceCollection services) { services.AddSingleton(provider => new WinUIDispatcher(DispatcherQueue.GetForCurrentThread())); services.AddTransient(); services.AddSingleton(); services.AddTransient(); services.AddTransient(); services.AddScopedHandler(nameof(ContentControl)); services.AddScopedHandler(nameof(ContentDialog)); services.AddTransient((Func>)(provider => new ProxyServiceCollection(services => { }))); return services; } }