22 lines
759 B
C#
22 lines
759 B
C#
using MediatR;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Sledgemapper.Api.Hubs;
|
|
using Sledgemapper.Api.Notifications;
|
|
using Sledgemapper.Clients;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sledgemapper.Api.Handlers
|
|
{
|
|
public class SendDeleteTileMessage : INotificationHandler<DeleteTileNotification>
|
|
{
|
|
private readonly IHubContext<SledgemapperHub, ISledgemapperClient> _hub;
|
|
|
|
public SendDeleteTileMessage(IHubContext<SledgemapperHub, ISledgemapperClient> hub) => _hub = hub;
|
|
|
|
public async Task Handle(DeleteTileNotification notification, CancellationToken cancellationToken)
|
|
{
|
|
await _hub.Clients.Groups(notification.Session.SessionName).DeleteTile(notification.Tile);
|
|
}
|
|
}
|
|
}
|