Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TraceOutputViewModel" /> class.
        /// </summary>
        /// <param name="dispatcherService">The dispatcher service.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="dispatcherService"/> is <c>null</c>.</exception>
        public TraceOutputViewModel(IDispatcherService dispatcherService)
        {
            Argument.IsNotNull("dispatcherService", dispatcherService);

            _dispatcherService = dispatcherService;

            CopyToClipboard = new Command(OnCopyToClipboardExecute, OnCopyToClipboardCanExecute);
            ClearOutput = new Command(OnClearOutputExecute);
            ClearFilter = new Command(OnClearFilterExecute);

            _outputLogListener = new OutputLogListener();
            _outputLogListener.LogMessage += OnLogMessage;

            IgnoreCatelLogging = true;

            LogManager.AddListener(_outputLogListener);

            TraceEntries = new ObservableCollection<TraceEntry>();
            TraceEntriesSourceList = new CollectionViewSource { Source = TraceEntries };
            TraceEntriesList = TraceEntriesSourceList.View;
            Levels = Enum<LogEvent>.GetValues().OrderBy(x => x).ToList();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TraceOutputViewModel" /> class.
        /// </summary>
        /// <param name="dispatcherService">The dispatcher service.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="dispatcherService"/> is <c>null</c>.</exception>
        public TraceOutputViewModel(IDispatcherService dispatcherService)
        {
            Argument.IsNotNull("dispatcherService", dispatcherService);

            _dispatcherService = dispatcherService;

            CopyToClipboard = new Command(OnCopyToClipboardExecute, OnCopyToClipboardCanExecute);
            ClearOutput     = new Command(OnClearOutputExecute);
            ClearFilter     = new Command(OnClearFilterExecute);

            _outputLogListener             = new OutputLogListener();
            _outputLogListener.LogMessage += OnLogMessage;

            IgnoreCatelLogging = true;

            LogManager.AddListener(_outputLogListener);

            TraceEntries           = new ObservableCollection <TraceEntry>();
            TraceEntriesSourceList = new CollectionViewSource {
                Source = TraceEntries
            };
            TraceEntriesList = TraceEntriesSourceList.View;
            Levels           = Enum <LogEvent> .GetValues().OrderBy(x => x).ToList();
        }