2024-04-18 01:44:37 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Windows.UI.Core;
|
|
|
|
|
|
using Wino.Core.Domain.Interfaces;
|
|
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
namespace Wino.Core.UWP;
|
2025-02-16 11:35:43 +01:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public class UWPDispatcher : IDispatcher
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly CoreDispatcher _coreDispatcher;
|
2025-02-16 11:43:30 +01:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public UWPDispatcher(CoreDispatcher coreDispatcher)
|
|
|
|
|
|
{
|
|
|
|
|
|
_coreDispatcher = coreDispatcher;
|
2025-02-16 11:43:30 +01:00
|
|
|
|
}
|
2025-02-16 11:54:23 +01:00
|
|
|
|
|
|
|
|
|
|
public Task ExecuteOnUIThread(Action action)
|
|
|
|
|
|
=> _coreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).AsTask();
|
2024-04-18 01:44:37 +02:00
|
|
|
|
}
|