Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        void ViewModelNewLogEntry(object sender, NewLogEntryInfoEventHandlerArgs e)
        {
            var balloon = new NewLogEntryBalloon(e.LogSubscriptionName, e.Author, e.Message);

            NotifyIcon.ShowCustomBalloon(balloon, PopupAnimation.Fade, 5000);
        }