public void Log(LogEventViewModel logEvent) { Dispatcher.BeginInvoke(new Action(() => { this.LogEntries.Add(logEvent); })); }
public void Log(string Source, LogLevel level, string message) { LogEventInfo info = new LogEventInfo(level, Source, message); info.TimeStamp = DateTime.Now; var model = new LogEventViewModel(info); Log(model); }
protected void LogReceived(AsyncLogEventInfo log) { LogEventViewModel vm = new LogEventViewModel(log.LogEvent); Dispatcher.BeginInvoke(new Action(() => { if (MaxRowCount > 0 && LogEntries.Count >= MaxRowCount) { LogEntries.RemoveAt(0); } LogEntries.Add(vm); if (AutoScrollToLast) { ScrollToLast(); } //ItemAdded(this, (NLogEvent)log.LogEvent); })); }