tesses.http/Tesses.Http/SendEvents.cs

30 lines
694 B
C#
Raw Normal View History

2022-08-22 17:30:32 +00:00
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Tesses.Http
{
internal class SendEventArgs : EventArgs
{
public string Data {get;set;}
}
public class SendEvents
{
internal event EventHandler<SendEventArgs> EventReceived;
public void SendEvent(object data)
{
SendEvent(JsonConvert.SerializeObject(data));
}
public void SendEvent(string e)
{
try{
EventReceived?.Invoke(this,new SendEventArgs(){Data=e});
}catch(Exception ex)
{
_=ex;
}
}
}
}