Ejemplo n.º 1
0
        private void ProcessEvent(TraceEventType eventLogEntryType, string message = null, string detailMessage = null)
        {
            var item = new AppModelTraceItem
            {
                Details   = detailMessage,
                Message   = message,
                Type      = eventLogEntryType,
                Timestamp = DateTime.Now
            };

            if ((Application.Current != null) && (Application.Current.Dispatcher != null) && !Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() => this.LogItems.Add(item)));
            }
            else
            {
                this.LogItems.Add(item);
            }
            File.AppendAllText(LogFile, item.ToString());
        }
Ejemplo n.º 2
0
        private void ProcessEvent(TraceEventType eventLogEntryType, string message=null, string detailMessage=null)
        {
            var item = new AppModelTraceItem
                {
                    Details = detailMessage,
                    Message = message,
                    Type = eventLogEntryType,
                    Timestamp = DateTime.Now
                };

            if ((Application.Current != null) && (Application.Current.Dispatcher != null) && !Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() => this.LogItems.Add(item)));
            }
            else
            {
                this.LogItems.Add(item);
            }
            File.AppendAllText(LogFile, item.ToString());
        }