public RepositoryWatcher(SDConnection connection, InitialPayload payload) : base(connection, payload) { settings = payload.Settings == null || payload.Settings.Count == 0 ? PluginSettings.CreateDefaultSettings() : payload.Settings.ToObject <PluginSettings>(); watcher = WatcherFactory.GetWatcher(settings); Timer = new Timer(); Timer.AutoReset = true; Timer.Elapsed += new ElapsedEventHandler(UpdateKey); }
public override void ReceivedSettings(ReceivedSettingsPayload payload) { try { Tools.AutoPopulateSettings(settings, payload.Settings); settings.UpdateSettingsEnum(); watcher = WatcherFactory.GetWatcher(settings); initialDateOffset = initialDateOffset.Subtract(new TimeSpan(settings.InitialOffset, 0, 0, 0)); UpdateTimer(); SaveSettings(); } catch (Exception ex) { Logger.Instance.LogMessage(TracingLevel.ERROR, ex.Message); Connection.ShowAlert().Wait(); } }