Esempio n. 1
0
        public bool AbortFirstEvent <T>()
            where T : EventBase
        {
            var type     = typeof(T);
            var toRemove = WriteQueue.FirstOrDefault(e => e.GetType() == type);

            if (toRemove == null)
            {
                return(false);
            }

            WriteQueue.Remove(toRemove);
            Log.Trace("Aborted {0}", type.Name);
            return(true);
        }
        /// <summary>
        /// Removes the oldest message of type T.  Messages cannot be removed after
        /// the queue has begun to process.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>
        /// True if an event was aborted.
        /// </returns>
        public bool RemoveFirstMessage <T>()
            where T : Message
        {
            var type     = typeof(T);
            var toRemove = WriteQueue.First(m => m.GetType() == type);

            if (toRemove == null)
            {
                return(false);
            }

            WriteQueue.Remove(toRemove);
            Log.VerboseFmt("{0} aborted message {1}", Parent.FullName, type.Name);
            return(true);
        }