added dispatcher service

This commit is contained in:
Jahn Spohrer 2024-09-05 16:08:21 +02:00
parent 814cb58742
commit 3cda100d82
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,8 @@
using System;
namespace BetterRaid.Services;
public interface ISynchronizaionService
{
void Invoke(Action action);
}

View File

@ -0,0 +1,18 @@
using Avalonia.Threading;
using System;
using System.Threading;
namespace BetterRaid.Services.Implementations;
public class DispatcherService : ISynchronizaionService
{
private readonly Dispatcher dispatcher;
public DispatcherService(Dispatcher dispatcher)
{
this.dispatcher = dispatcher;
}
public void Invoke(Action action)
{
dispatcher.Invoke(action);
}
}