30 lines
694 B
C#
30 lines
694 B
C#
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|