This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
gameservicewarden/GameServiceWarden/GameServiceWarden.Core/UI/IPCPresenter.cs

30 lines
875 B
C#

using System.Text.Json;
using System.Threading.Tasks;
using GameServiceWarden.InteractionAPI;
using GameServiceWarden.InteractionAPI.Module;
using GameServiceWarden.Core.Module;
namespace GameServiceWarden.Core.UI
{
public class IPCPresenter : IServiceManagerMonitor
{
private IPCMediator mediator;
public IPCPresenter(IPCMediator mediator)
{
this.mediator = mediator;
}
public void Present(ServiceManagerTotal state)
{
Task replyTask = mediator.ReplyAll(CommunicableType.View, JsonSerializer.SerializeToUtf8Bytes(state));
replyTask.Wait();
}
public void Present(ServiceManagerDelta delta)
{
Task replyTask = mediator.ReplyAll(CommunicableType.Delta, JsonSerializer.SerializeToUtf8Bytes(delta));
replyTask.Wait();
}
}
}