Esempio n. 1
0
        /// <summary>
        ///     Returns new EventMessages or null, if waiting next message.
        /// </summary>
        /// <param name="eventMessagesCollection"></param>
        /// <returns></returns>
        public Server.EventMessage[]? EventMessagesCallback(EventMessagesCollection eventMessagesCollection)
        {
            if (Disposed)
            {
                throw new ObjectDisposedException("Cannot access a disposed ClientEventList.");
            }

            if (eventMessagesCollection.Guid != @"" && _incompleteEventMessagesCollectionCollection.Count > 0)
            {
                var beginEventMessagesCollection = _incompleteEventMessagesCollectionCollection.TryGetValue(eventMessagesCollection.Guid);
                if (beginEventMessagesCollection is not null)
                {
                    _incompleteEventMessagesCollectionCollection.Remove(eventMessagesCollection.Guid);
                    beginEventMessagesCollection.CombineWith(eventMessagesCollection);
                    eventMessagesCollection = beginEventMessagesCollection;
                }
            }

            if (eventMessagesCollection.NextCollectionGuid != @"")
            {
                _incompleteEventMessagesCollectionCollection[eventMessagesCollection.NextCollectionGuid] = eventMessagesCollection;

                return(null);
            }
            else
            {
                var result = new List <Server.EventMessage>();

                foreach (var eventMessage in eventMessagesCollection.EventMessages)
                {
                    result.Add(eventMessage);
                }

                return(result.ToArray());
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     Returns null, if incomplete EventMessageArray.
 /// </summary>
 /// <param name="eventList"></param>
 /// <param name="eventMessages"></param>
 /// <returns></returns>
 private Server.EventMessage[]? EventMessagesCallback(ClientEventList eventList, EventMessagesCollection eventMessagesCollection)
 {
     Server.EventMessage[]? newEventMessages = eventList.EventMessagesCallback(eventMessagesCollection);
     if (newEventMessages is not null && newEventMessages.Length > 0)
     {
         eventList.RaiseEventMessagesCallbackEvent(newEventMessages);
     }
     return(newEventMessages);
 }