Added event for connected to drive connected fb on module. Status change is there but it uses socket status which is not available in UDP.

This commit is contained in:
Joshua Gutenplan
2019-06-26 19:36:19 -07:00
parent a9dbaf21c2
commit f0ad3b3706
2 changed files with 28 additions and 0 deletions

View File

@@ -43,6 +43,8 @@ namespace PepperDash.Core
//public event GenericSocketStatusChangeEventDelegate SocketStatusChange;
public event EventHandler<GenericSocketStatusChageEventArgs> ConnectionChange;
public event EventHandler<GenericUdpConnectedEventArgs> UpdateConnectionStatus;
public SocketStatus ClientStatus
{
get
@@ -187,6 +189,10 @@ namespace PepperDash.Core
if (status == SocketErrorCodes.SOCKET_OK)
IsConnected = true;
var handler = UpdateConnectionStatus;
if (handler != null)
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
// Start receiving data
Server.ReceiveDataAsync(Receive);
}
@@ -200,6 +206,10 @@ namespace PepperDash.Core
Server.DisableUDPServer();
IsConnected = false;
var handler = UpdateConnectionStatus;
if (handler != null)
handler(this, new GenericUdpConnectedEventArgs(UIsConnected));
}