Exemplo n.º 1
0
 protected void OnMessageStringReceived(MessageStringEventArgs e)
 {
     if (MessageStringReceived != null)
     {
         MessageStringReceived(this, e);
     }
 }
Exemplo n.º 2
0
        //public MessageClient(string deviceName, string ipAddress, int portNumber) : this(deviceName)
        //{
        //    IpAddress = ipAddress;
        //    PortNumber = portNumber;
        //}

        void client_MessageStringReceived(object sender, MessageStringEventArgs e)
        {
            try
            {
                string paddedSerializedMessage = e.MessageString;

                string  cleanedUpSerializedMessage = CodeAbility.MonitorAndCommand.Helpers.JsonHelpers.CleanUpPaddedSerializedMessage(paddedSerializedMessage);
                Message message = JsonConvert.DeserializeObject <Message>(cleanedUpSerializedMessage);

                if (MessageStringReceived != null)
                {
                    MessageStringReceived(this, new MessageEventArgs(message));
                }
            }
            catch (Exception exception)
            {
            }
        }