/*=========================*/ #endregion #region Events /*=========================*/ void watcher_Changed(object sender, FileSystemEventArgs e) { Log.Write(String.Format("{0} has been {1} ", e.Name, e.ChangeType), LogMessageType.Information); FileSystemWatcher watcher = (FileSystemWatcher)sender; string handlerService; if (!_handlers.TryGetValue(watcher, out handlerService)) { Log.Write(String.Format("Invalid handler specified for {0}.", e.Name), LogMessageType.Warning); return; } // Make the request to the schedule manager using (ServiceClient <IScheduleManager> scheduleManager = _scheduleManagerConfiguration != null && _scheduleManagerUrl != null ? new ServiceClient <IScheduleManager>(_scheduleManagerConfiguration, _scheduleManagerUrl): new ServiceClient <IScheduleManager>()) { SettingsCollection options = new SettingsCollection(); options.Add("SourceFilePath", e.FullPath); //If we have the HandlerServiceParameters attribute in the configuration, append it //to the options we are sending to the service. foreach (DirectoryElement de in (DirectoryElementCollection)Instance.Configuration.ExtendedElements["Directories"]) { if (de.Path == e.FullPath && de.HandlerServiceParameters != String.Empty) { //This is the path. Get the additional information. SettingsCollection sc = new SettingsCollection(de.HandlerServiceParameters); options.Merge(sc); break; } } scheduleManager.Service.AddToSchedule(handlerService, -1, DateTime.Now, options); } }