protected virtual void RaiseNewDataSent(NewDataEventArgs e)
        {
            EventHandler <NewDataEventArgs> eventHandler = NewDataSent;

            if (eventHandler == null)
            {
                return;
            }
            //    Log.Error("In RaiseNewDataSent");
            eventHandler(this, e);
        }
 protected virtual void RaiseNewDataReceived(NewDataEventArgs e)
 {
     try
     {
         EventHandler <NewDataEventArgs> eventHandler = NewDataReceived;
         if (eventHandler == null)
         {
             return;
         }
         //  Log.Error("In RaiseNewDataReceived");
         eventHandler(this, e);
     }
     catch (Exception error)
     {
         Log.Error("Exception in RaiseNewDataReceived" + error);
     }
 }
Ejemplo n.º 3
0
        public void NewDataHandler(object sender, NewDataEventArgs e)
        {
            var messages = (IEnumerable <IMessage>) new IMessage[] {};

            lock (deserializationLock)
            {
                // ensure that the deserialization can run through and change states if necessary,
                // before any more data can be recieved and deserialized
                messages = State.Deserialize(this, e.Buffer);
            }

            foreach (var message in messages)
            {
                // call the template method
                Trigger(message);
            }
        }
        protected void OnNewDataToSend(object source, NewDataEventArgs eventData)
        {
            NewDataToSendHandler handler = NewDataToSend;

            handler?.Invoke(source, eventData);
        }