コード例 #1
0
        void IMessageListener.PushMessage(EngineMessage message)
        {
            T msg = message as T;

            if (msg != null)
            {
                lock (locker) messages.Enqueue(msg);
            }
        }
コード例 #2
0
        /// <summary>
        /// Posts a global message.
        /// </summary>
        public static void PostMessage(EngineMessage message)
        {
            lock (ListenersLocker)
            {
                foreach (IMessageListener listener in MessageListeners)
                {
                    listener.PushMessage(message);
                }
            }

            PostGlobalLogMessage(string.Format("Global message {0} with ID {1} posted to all listener queues.", message.GetType().FullName, message.Id),
                                 LogMessageKind.Information, LogMessagePriority.Engine);
        }