Example #1
0
        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;
            }
        }
Example #2
0
 public static bool InvokeConnectRequested(string comPort, int baudRate)
 {
     if (ConnectRequested != null)
     {
         return(ConnectRequested.Invoke(comPort, baudRate));
     }
     else
     {
         return(false);
     }
 }
Example #3
0
 void OnConnectRequest(P2PSessionRequest_t ev)
 {
     ConnectRequested?.Invoke(ev);
 }