コード例 #1
0
ファイル: LogViewer.xaml.cs プロジェクト: BjDi/XbimWindowsUI
        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;
                //    });
                //}

            }
        }
コード例 #2
0
        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");
                }
            }
        }
コード例 #3
0
        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);
            }
        }