コード例 #1
0
 public void Log(LogEventViewModel logEvent)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         this.LogEntries.Add(logEvent);
     }));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
            }));
        }