예제 #1
0
 private void UnsubscribeToEvents(IObservableLog observableLog)
 {
     if (observableLog != null)
     {
         observableLog.LogEvent -= OnLogEvent;
     }
 }
예제 #2
0
 private void UnsubscribeToEvents(IObservableLog observableLog)
 {
     if (observableLog != null)
     {
         observableLog.LogEvent -= OnLogEvent;
     }
 }
예제 #3
0
        public FormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter)
        {
            if (observableLog == null) { throw new ArgumentNullException("observableLog"); }
            if (loggedItemFormatter == null) { throw new ArgumentNullException("loggedItemFormatter"); }

            _observableLog = observableLog;
            _loggedItemFormatter = loggedItemFormatter;
            _observableLog.LogEvent += OnLogEvent;
        }
예제 #4
0
        /// <summary>
        /// Adds an observed log to the hub
        /// </summary>
        /// <param name="observableLog"></param>
        public bool AddObservedLog(IObservableLog observableLog)
        {
            if (observableLog == null) { throw new ArgumentNullException("observableLog"); }

            if (!_observedLogs.Contains(observableLog))
            {
                _observedLogs.Add(observableLog);
                SubscribeToEvents(observableLog);
                return true;
            }

            return false;
        }
예제 #5
0
        /// <summary>
        /// Removes all observed logs from the hub
        /// </summary>
        /// <param name="observableLog"></param>
        /// <returns>true si l'élément a été enlevé</returns>
        public bool RemoveLogObserver(IObservableLog observableLog)
        {
            var removed = false;

            if (observableLog != null)
            {
                removed = _observedLogs.Remove(observableLog);

                if (removed)
                {
                    UnsubscribeToEvents(observableLog);
                }
            }

            return removed;
        }
예제 #6
0
        /// <summary>
        /// Removes all observed logs from the hub
        /// </summary>
        /// <param name="observableLog"></param>
        /// <returns>true si l'élément a été enlevé</returns>
        public bool RemoveLogObserver(IObservableLog observableLog)
        {
            var removed = false;

            if (observableLog != null)
            {
                removed = _observedLogs.Remove(observableLog);

                if (removed)
                {
                    UnsubscribeToEvents(observableLog);
                }
            }

            return(removed);
        }
예제 #7
0
        /// <summary>
        /// Adds an observed log to the hub
        /// </summary>
        /// <param name="observableLog"></param>
        public bool AddObservedLog(IObservableLog observableLog)
        {
            if (observableLog == null)
            {
                throw new ArgumentNullException("observableLog");
            }

            if (!_observedLogs.Contains(observableLog))
            {
                _observedLogs.Add(observableLog);
                SubscribeToEvents(observableLog);
                return(true);
            }

            return(false);
        }
예제 #8
0
 public ToFileAsyncFormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter)
     : base(observableLog, loggedItemFormatter)
 {
 }
 public ToStringFormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter)
     : base(observableLog, loggedItemFormatter)
 {
 }
 public ToFileAsyncFormattingLogObserver(IObservableLog observableLog, ILoggedItemFormatter loggedItemFormatter)
     : base(observableLog, loggedItemFormatter)
 {
 }