From 3cda100d82714dc09a0ea62c37f3bf3fcfb7cd43 Mon Sep 17 00:00:00 2001 From: Jahn Spohrer <73436710+jahnspohrer@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:08:21 +0200 Subject: [PATCH] added dispatcher service --- Services/ISynchronizaionService.cs | 8 ++++++++ Services/Implementations/DispatcherService.cs | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Services/ISynchronizaionService.cs create mode 100644 Services/Implementations/DispatcherService.cs diff --git a/Services/ISynchronizaionService.cs b/Services/ISynchronizaionService.cs new file mode 100644 index 0000000..92f7aa8 --- /dev/null +++ b/Services/ISynchronizaionService.cs @@ -0,0 +1,8 @@ +using System; + +namespace BetterRaid.Services; + +public interface ISynchronizaionService +{ + void Invoke(Action action); +} diff --git a/Services/Implementations/DispatcherService.cs b/Services/Implementations/DispatcherService.cs new file mode 100644 index 0000000..124215e --- /dev/null +++ b/Services/Implementations/DispatcherService.cs @@ -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); + } +}