private ConfigurationChangeFileWatcher CreateWatcherForConfigSource(String configSource) { ConfigurationChangeFileWatcher watcher = null; if (MainConfigurationFileSource.Equals(configSource)) { watcher = new ConfigurationChangeFileWatcher(mainConfigurationFileName, configSource); } else { watcher = new ConfigurationChangeFileWatcher(Path.Combine(mainConfigurationFilePath, configSource), configSource); } watcher.ConfigurationChanged += OnConfigurationChanged; configSourceWatcherMapping.Add(configSource, watcher); if (refresh) { watcher.StartWatching(); } return watcher; }
private void SetUpWatcher(int refreshInterval, ConfigurationChangedEventHandler changed) { this.configWatcher = new ConfigurationChangeFileWatcher( GetFullFileName(this.configurationFilepath, this.ConfigSource), this.ConfigSource); this.configWatcher.SetPollDelayInMilliseconds(refreshInterval); this.configWatcher.ConfigurationChanged += changed; }
private ConfigurationChangeFileWatcher CreateWatcherForConfigSource(string configSource) { ConfigurationChangeFileWatcher watcher = null; if ("".Equals(configSource)) { watcher = new ConfigurationChangeFileWatcher(this.mainConfigurationFileName, configSource); } else { watcher = new ConfigurationChangeFileWatcher(Path.Combine(this.mainConfigurationFilePath, configSource), configSource); } watcher.ConfigurationChanged += new ConfigurationChangedEventHandler(this.OnConfigurationChanged); this.configSourceWatcherMapping.Add(configSource, watcher); if (this.refresh) { watcher.StartWatching(); } return watcher; }
void IDisposable.Dispose() { if (this.configWatcher != null) { this.configWatcher.Dispose(); this.configWatcher = null; } }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (this.configWatcher != null) { this.configWatcher.Dispose(); this.configWatcher = null; } } }