void appender_Logged(object sender, LogEventArgs e) { foreach (var loggingEvent in e.LoggingEvents) { var m = new EventViewModel(loggingEvent); // LoggedEvents.Add(m); App.Current.Dispatcher.BeginInvoke((Action)delegate() { LoggedEvents.Add(m); }); //if (Report.Dispatcher.CheckAccess()) //{ // Report.Text += loggingEvent.RenderedMessage; // Report.Text += loggingEvent.ExceptionObject.Message; //} //else //{ // Dispatcher.Invoke((Action)delegate() // { // Report.Text += loggingEvent.RenderedMessage; // }); //} } }
void appender_Logged(object sender, LogEventArgs e) { foreach (var loggingEvent in e.LoggingEvents) { if (loggingEvent.Level == Level.Error) { _numErrors ++; if (_numErrors == 1) OnPropertyChanged("AnyErrors"); OnPropertyChanged("NumErrors"); } if (loggingEvent.Level == Level.Warn) { _numWarnings++; if (_numWarnings == 1) OnPropertyChanged("AnyWarnings"); OnPropertyChanged("NumWarnings"); } } }
internal void appender_Logged(object sender, LogEventArgs e) { foreach (var loggingEvent in e.LoggingEvents) { var m = new EventViewModel(loggingEvent); // LoggedEvents.Add(m); Application.Current.Dispatcher.BeginInvoke((Action) delegate() { LoggedEvents.Add(m); }); Application.Current.Dispatcher.BeginInvoke((Action) UpdateLoggerCounts); } }