コード例 #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());
        }
コード例 #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());
        }