Esempio n. 1
0
        /// <summary>
        /// Adds the debug message listener.
        /// </summary>
        /// <param name="listener">The listener.</param>
        public static void AddDebugMessageListener(DebugMessageListener listener)
        {
            if (listener == null)
            {
                return;
            }

            lock (DebugLocker)
            {
                DebugListeners.Add(listener);
                System.Threading.Interlocked.Increment(ref HasDebugListeners);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Removes the debug message listener.
        /// </summary>
        /// <param name="listener">The listener.</param>
        /// <returns></returns>
        public static bool RemoveDebugMessageListener(DebugMessageListener listener)
        {
            if (listener == null)
            {
                return(false);
            }

            bool removed;

            lock (DebugLocker)
            {
                removed = DebugListeners.Remove(listener);
                System.Threading.Interlocked.Decrement(ref HasDebugListeners);
            }

            return(removed);
        }