예제 #1
0
        private bool InvokeMethodWithSkip(AllEventHandler _event, Packet packet)
        {
            var bl = new List <bool>();

            if (_event == null)
            {
                return(false);
            }
            foreach (var cea in _event.GetInvocationList().Cast <AllEventHandler>())
            {
                packet?.SeekRead(0, SeekOrigin.Begin);
                bl.Add(cea.Invoke(packet, this));
            }
            return(bl.Any(b => b));
        }
예제 #2
0
        /// <summary>
        /// Find the event handler for the given type. If found, invoke it.
        /// </summary>
        /// <param name="eventType"></param>
        /// <param name="evt"></param>
        private JournalEventArgs FireEvent(string eventType, JObject evt)
        {
            if (journalEventsByName.TryGetValue(eventType, out JournalEvent handler))
            {
                var eventArgs = handler.FireEvent(this, evt);

                AllEventHandler?.Invoke(this, eventArgs);

                return(eventArgs);
            }
            else
            {
                Trace.TraceWarning("No event handler registered for journal event of type: " + eventType);
            }

            return(null);
        }