public LogSubscription AddLogSubscription(string name, string logProviderTypeName, string url)
 {
     var logSubscription = new LogSubscription(name, logProviderTypeName, url) { Log = new TrulyObservableCollection<LogEntry>() };
     using (var db = new SourceLogContext())
     {
         db.LogSubscriptions.Add(logSubscription);
         db.SaveChanges();
     }
     logSubscription.NewLogEntry += (o, e) => NewLogEntry(o, e);
     LogSubscriptions.Add(logSubscription);
     return logSubscription;
 }
 public void MarkAsReadAndSave()
 {
     Task.Factory.StartNew(() =>
     {
         using (var db = new SourceLogContext())
         {
             //var logEntry = db.LogEntries.Find(LogEntryId);
             var logEntry = db.LogEntries.Where(le => le.LogEntryId == LogEntryId).Include(le => le.LogSubscription).Single();
             db.LogEntries.Attach(logEntry);
             logEntry.Read = true;
             db.SaveChanges();
         }
     });
 }
Exemple #3
0
        public LogSubscription AddLogSubscription(string name, string logProviderTypeName, string url)
        {
            var logSubscription = new LogSubscription(name, logProviderTypeName, url)
            {
                Log = new TrulyObservableCollection <LogEntry>()
            };

            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Add(logSubscription);
                db.SaveChanges();
            }
            logSubscription.NewLogEntry += (o, e) => NewLogEntry(o, e);
            LogSubscriptions.Add(logSubscription);
            return(logSubscription);
        }
 public void DeleteSubscription(LogSubscription logSubscription)
 {
     logSubscription.LogProvider.Dispose();
     logSubscription.UnsubscribeEvents();
     using (var db = new SourceLogContext())
     {
         foreach (var logEntry in logSubscription.Log)
         {
             logEntry.ChangedFiles = null;
             logEntry.LogSubscription = logSubscription;
         }
         db.LogSubscriptions.Attach(logSubscription);
         db.LogSubscriptions.Remove(logSubscription);
         db.SaveChanges();
     }
     _logSubscriptions.Remove(logSubscription);
 }
Exemple #5
0
 public void DeleteSubscription(LogSubscription logSubscription)
 {
     logSubscription.LogProvider.Dispose();
     logSubscription.UnsubscribeEvents();
     using (var db = new SourceLogContext())
     {
         foreach (var logEntry in logSubscription.Log)
         {
             logEntry.ChangedFiles    = null;
             logEntry.LogSubscription = logSubscription;
         }
         db.LogSubscriptions.Attach(logSubscription);
         db.LogSubscriptions.Remove(logSubscription);
         db.SaveChanges();
     }
     _logSubscriptions.Remove(logSubscription);
 }
Exemple #6
0
        public void Update(string name, string pluginName, string settingsXml)
        {
            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Attach(this);

                Name           = name;
                PluginTypeName = pluginName;
                Url            = settingsXml;

                db.SaveChanges();
            }

            // Not sure if this is necessary
            LogProvider.NewLogEntry     -= AddNewLogEntry;
            LogProvider.PluginException -= LogProviderLogProviderException;

            LoadPlugin();
        }
 public void MarkAsReadAndSave()
 {
     Task.Factory.StartNew(() =>
         {
             using (var db = new SourceLogContext())
             {
                 //var logEntry = db.LogEntries.Find(LogEntryId);
                 var logEntry = db.LogEntries.Where(le => le.LogEntryId == LogEntryId).Include(le => le.LogSubscription).Single();
                 db.LogEntries.Attach(logEntry);
                 logEntry.Read = true;
                 db.SaveChanges();
             }
         });
 }
        public void Update(string name, string pluginName, string settingsXml)
        {
            using (var db = new SourceLogContext())
            {
                db.LogSubscriptions.Attach(this);

                Name = name;
                PluginTypeName = pluginName;
                Url = settingsXml;

                db.SaveChanges();
            }

            // Not sure if this is necessary
            LogProvider.NewLogEntry -= AddNewLogEntry;
            LogProvider.PluginException -= LogProviderLogProviderException;

            LoadPlugin();
        }