Example #1
0
        /// <summary>
        /// Raise the MessageUpdated event.
        /// </summary>
        /// <param name="e">Event arguments (if null the event is cancelled).</param>
        protected override void OnMessageUpdated(MessageUpdatedEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            e.DataType = TypeMap.ContainsKey(e.Key) ? TypeMap[e.Key] : null;
            base.OnMessageUpdated(e);
        }
Example #2
0
        /// <summary>
        /// Raise the MessageUpdated event.
        /// </summary>
        /// <param name="e">Event arguments (if null the event is cancelled).</param>
        protected virtual void OnMessageUpdated(MessageUpdatedEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            if (MessageUpdated != null)
            {
                MessageUpdated(this, e);
            }
        }
Example #3
0
 public void Add(MessageUpdatedEventArgs item)
 {
     _receivedMessages.Add(item);
 }
Example #4
0
        private void FahClientMessageUpdated(object sender, MessageUpdatedEventArgs e)
        {
            if (AbortFlag) return;

             _messages.Add(e);
             JsonMessage message = _fahClient.GetJsonMessage(e.Key);
             Logger.DebugFormat(Constants.ClientNameFormat, Settings.Name, message.GetHeader());

             if (e.DataType == typeof(Heartbeat))
             {
            _messages.SetHeartbeat(_fahClient.GetMessage<Heartbeat>());
             }
             else if (e.DataType == typeof(UnitCollection))
             {
            _messages.UnitCollection = _fahClient.GetMessage<UnitCollection>();
             }
             else if (e.DataType == typeof(SlotCollection))
             {
            _messages.SlotCollection = _fahClient.GetMessage<SlotCollection>();
            foreach (var slot in _messages.SlotCollection)
            {
               _fahClient.SendCommand(String.Format(CultureInfo.InvariantCulture, Constants.FahClientSlotOptions, slot.Id));
            }
             }
             else if (e.DataType == typeof(SlotOptions))
             {
            _messages.AddSlotOptions(_fahClient.GetMessage<SlotOptions>());
             }
             else if (e.DataType == typeof(LogRestart))
             {
            LogFragment logFragment = _fahClient.GetMessage<LogRestart>();
            IEnumerable<char[]> chunks = logFragment.Value.GetChunks();

            // clear
            _logText.Length = 0;
            WriteToLocalFahLogCache(chunks);
            AppendToLogBuffer(chunks, logFragment.Value.Length);
             }
             else if (e.DataType == typeof(LogUpdate))
             {
            LogFragment logFragment = _fahClient.GetMessage<LogUpdate>();
            IEnumerable<char[]> chunks = logFragment.Value.GetChunks();

            WriteToLocalFahLogCache(chunks);
            AppendToLogBuffer(chunks, logFragment.Value.Length);
             }
        }
Example #5
0
        /// <summary>
        /// Raise the MessageUpdated event.
        /// </summary>
        /// <param name="e">Event arguments (if null the event is cancelled).</param>
        protected virtual void OnMessageUpdated(MessageUpdatedEventArgs e)
        {
            if (e == null) return;

             if (MessageUpdated != null)
             {
            MessageUpdated(this, e);
             }
        }