This commit is contained in:
Dan Clark
2024-11-22 18:52:25 +00:00
parent 8a2497be82
commit e809c22cb7
15 changed files with 145 additions and 31 deletions
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml.Controls;
using Toolkit.Foundation;
@@ -8,7 +9,7 @@ public static class IServiceCollectionExtensions
{
public static IServiceCollection AddWinUI(this IServiceCollection services)
{
services.AddTransient<IDispatcher, WinUIDispatcher>();
services.AddSingleton<IDispatcher>(provider => new WinUIDispatcher(DispatcherQueue.GetForCurrentThread()));
services.AddTransient<IDispatcherTimerFactory, DispatcherTimerFactory>();
services.AddSingleton<IWindowRegistry, WindowRegistry>();