TomatenMusic-V2/TomatenMusic/Services/EventBus.cs

32 lines
807 B
C#
Raw Normal View History

2022-03-28 19:52:42 +02:00
using DSharpPlus.Entities;
using Emzi0767.Utilities;
using Microsoft.AspNetCore.Mvc;
using TomatenMusic_Api.Models;
using TomatenMusic_Api.Models.EventArgs;
namespace TomatenMusic_Api;
public class InProcessEventBus
{
public event AsyncEventHandler<InProcessEventBus, ChannelConnectArgs>? OnConnectRequest;
public event AsyncEventHandler<InProcessEventBus, ChannelDisconnectArgs>? OnDisconnectRequest;
public event AsyncEventHandler<InProcessEventBus, TrackPlayArgs> OnPlayRequest;
public void OnConnectRequestEvent(ChannelConnectArgs e)
{
_ = OnConnectRequest?.Invoke(this, e);
}
public void OnDisconnectRequestEvent(ChannelDisconnectArgs e)
{
_ = OnDisconnectRequest?.Invoke(this, e);
}
public void OnPlayRequestEvent(TrackPlayArgs e)
{
_ = OnPlayRequest?.Invoke(this, e);
}
}