public void AddWatchFolder(WatchFolderSettings watchFolderSetting, TaskSettings taskSettings) { if (!IsExist(watchFolderSetting)) { if (!taskSettings.WatchFolderList.Contains(watchFolderSetting)) { taskSettings.WatchFolderList.Add(watchFolderSetting); } WatchFolder watchFolder = new WatchFolder { Settings = watchFolderSetting, TaskSettings = taskSettings }; watchFolder.FileWatcherTrigger += path => { TaskSettings taskSettingsCopy = TaskSettings.GetSafeTaskSettings(taskSettings); UploadManager.UploadFile(path, taskSettingsCopy); }; WatchFolders.Add(watchFolder); if (taskSettings.WatchFolderEnabled) { watchFolder.Enable(); } } }
public void UpdateWatchFolderState(WatchFolderSettings watchFolderSetting) { WatchFolder watchFolder = FindWatchFolder(watchFolderSetting); if (watchFolder != null) { if (watchFolder.TaskSettings.WatchFolderEnabled) { watchFolder.Enable(); } else { watchFolder.Dispose(); } } }