private void _conn_MessageReceived(Connection source, string data) { RequestModel model = JsonConvert.DeserializeObject <RequestModel>(data); switch (model.Action) { case "TurnData": Turn = (TurnState)JsonConvert.DeserializeObject <TurnRequest>(data).Turn; break; case "Connect": ConnectRequested?.Invoke(this, null); break; case "Settings": try { Send(new SettingsResponseModel() { Settings = Config.Constants }); } catch (ConnectionBusyException) { _modelsQueue.Enqueue(new SettingsResponseModel() { Settings = Config.Constants }); } break; } }
public static bool InvokeConnectRequested(string comPort, int baudRate) { if (ConnectRequested != null) { return(ConnectRequested.Invoke(comPort, baudRate)); } else { return(false); } }
void OnConnectRequest(P2PSessionRequest_t ev) { ConnectRequested?.Invoke(ev); }