public void AddNewLogEntry(object sender, NewLogEntryEventArgs e) { var logEntry = new LogEntry(e.LogEntry); if (Log.Count(l => l.Revision == logEntry.Revision) > 0) { Logger.Write(new Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry { Message = String.Format("Subscription \"{2}\" already contains revision {0}, date (ticks) {1}", logEntry.Revision, logEntry.CommittedDate.Ticks, Name), Severity = TraceEventType.Error }); } logEntry.GenerateFlowDocuments(); using (var db = SourceLogContextProvider()) { logEntry.LogSubscription = db.LogSubscriptions.Find(LogSubscriptionId); db.LogEntries.Add(logEntry); db.SaveChanges(); } logEntry.UnloadChangedFiles(); if (_uiThread != null) { _uiThread.Post(entry => { Log.Add((LogEntry)entry); NotifyPropertyChanged("Log"); var logEntryInfo = new NewLogEntryInfoEventHandlerArgs { LogSubscriptionName = Name, Author = ((LogEntry)entry).Author, Message = ((LogEntry)entry).Message }; NewLogEntry(this, logEntryInfo); }, logEntry); } }
public void AddNewLogEntry(object sender, NewLogEntryEventArgs e) { var logEntry = new LogEntry(e.LogEntry); if (Log.Count(l => l.Revision == logEntry.Revision) > 0) { SourceLogLogger.LogError($"Subscription \"{Name}\" already contains revision {logEntry.Revision}, date (ticks) {logEntry.CommittedDate.Ticks}"); } logEntry.GenerateFlowDocuments(); using (var db = SourceLogContextProvider()) { logEntry.LogSubscription = db.LogSubscriptions.Find(LogSubscriptionId); db.LogEntries.Add(logEntry); db.SaveChanges(); } logEntry.UnloadChangedFiles(); if (_uiThread != null) { _uiThread.Post(entry => { Log.Add((LogEntry)entry); NotifyPropertyChanged("Log"); var logEntryInfo = new NewLogEntryInfoEventHandlerArgs { LogSubscriptionName = Name, Author = ((LogEntry)entry).Author, Message = ((LogEntry)entry).Message }; NewLogEntry(this, logEntryInfo); }, logEntry); } }