using System;
using System.Threading.Tasks;
using PSCHelpdesk.Shared.Service;

namespace PSCHelpdesk.Services;

public class AvaloniaDispatcherService: IUserInterfaceDispatchService
{
    public void Invoke(Action action)
    {
        Avalonia.Threading.Dispatcher.UIThread.Post(action);
    }

    public Task InvokeAsync(Action action)
    {
        return Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(action).GetTask();
    }
}