private void CreateFileSystemWatcher() { // Lazily create the static file system watcher // on first use. if (StoreWatcher == null) { lock (SyncObject) { if (StoreWatcher == null) { StoreWatcher = new FileSystemWatcher(ScheduledJobStore.GetJobDefinitionLocation()); StoreWatcher.IncludeSubdirectories = true; StoreWatcher.NotifyFilter = NotifyFilters.LastWrite; StoreWatcher.Filter = "Results.xml"; StoreWatcher.EnableRaisingEvents = true; StoreWatcher.Changed += (object sender, FileSystemEventArgs e) => { UpdateRepositoryObjects(e); }; } } } }
public static bool IsDefaultUserPath(string definitionPath) { return(definitionPath.Equals(ScheduledJobStore.GetJobDefinitionLocation(), StringComparison.OrdinalIgnoreCase)); }
private void CreateFileSystemWatcher() { if (ScheduledJobSourceAdapter.StoreWatcher == null) { lock (ScheduledJobSourceAdapter.SyncObject) { if (ScheduledJobSourceAdapter.StoreWatcher == null) { ScheduledJobSourceAdapter.StoreWatcher = new FileSystemWatcher(ScheduledJobStore.GetJobDefinitionLocation()); ScheduledJobSourceAdapter.StoreWatcher.IncludeSubdirectories = true; ScheduledJobSourceAdapter.StoreWatcher.NotifyFilter = NotifyFilters.LastWrite; ScheduledJobSourceAdapter.StoreWatcher.Filter = "Results.xml"; ScheduledJobSourceAdapter.StoreWatcher.EnableRaisingEvents = true; FileSystemWatcher storeWatcher = ScheduledJobSourceAdapter.StoreWatcher; storeWatcher.Changed += (object sender, FileSystemEventArgs e) => ScheduledJobSourceAdapter.UpdateRepositoryObjects(e); } } } }