2025-09-29 11:16:14 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using CommunityToolkit.WinUI;
|
|
|
|
|
using Microsoft.UI.Dispatching;
|
|
|
|
|
using Wino.Core.Domain.Interfaces;
|
|
|
|
|
|
2025-09-29 11:23:44 +02:00
|
|
|
namespace Wino.Core.WinUI;
|
2025-09-29 11:16:14 +02:00
|
|
|
|
|
|
|
|
public class WinUIDispatcher : IDispatcher
|
|
|
|
|
{
|
|
|
|
|
private readonly DispatcherQueue _coreDispatcher;
|
|
|
|
|
|
|
|
|
|
public WinUIDispatcher(DispatcherQueue coreDispatcher)
|
|
|
|
|
{
|
|
|
|
|
_coreDispatcher = coreDispatcher;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task ExecuteOnUIThread(Action action) => _coreDispatcher.EnqueueAsync(action, DispatcherQueuePriority.Normal);
|
|
|
|
|
}
|