public static IEnumerable <IFolderWatcher> GetFolderWatchers(this FoldersWatcherConfig config) { switch (config.IFolderWatcher) { case "Default": if (string.IsNullOrEmpty(config.FoldersConfigsPath)) { throw new ArgumentException("config.FoldersConfigsPath"); } IEnumerable <FolderConfig> foldersConfigs = config.FoldersConfigsPath.GetFolderConfigs(); switch (config.IFolderEventsHandler) { case "Default": switch (config.IOperationEventFactory) { case "Default": IOperationEventFactory operationEventFactory = new FileSystemOperationEventFactory(); if (config.LoggerTypes == null || config.LoggerTypes.Length == 0) { throw new ArgumentException("config.LoggerTypes"); } IFolderEventsLoggerFactory folderEventsLoggerFactory = new FolderEventsLoggerFactory(); IEnumerable <IFolderEventsHandler> folderEventsHandlers = foldersConfigs.GetFolderEventsHandlers(config.LoggerTypes, folderEventsLoggerFactory, operationEventFactory); IFoldersWatcherFactory foldersWatcherFactory = new FoldersWatcherFactoryViaFileSystemWatcher(); return(foldersWatcherFactory.CreateFoldersWatcher(folderEventsHandlers, foldersConfigs)); default: throw new ArgumentException("config.IOperationEventFactory"); } default: throw new ArgumentException("config.IFolderEventsHandler"); } default: throw new ArgumentException("config.IFolderWatcher"); } //string appid = "DVL_Sync_EventLogger"; //Windows10NotificationsHelper.TryCreateShortcut(appid); }
private void SetFolderWatcherConfig(string path) { this.folderWatchersConfig = path.GetFoldersWatcherConfig(); //Setting In UI this.textBoxIFolderWatcher.Text = this.folderWatchersConfig.IFolderWatcher; this.textBoxFoldersConfigsPath.Text = this.folderWatchersConfig.FoldersConfigsPath; this.textBoxIFolderEventsHandler.Text = this.folderWatchersConfig.IFolderEventsHandler; this.textBoxIOperationEventFactory.Text = this.folderWatchersConfig.IOperationEventFactory; SetLoggerTypes(); //SaveFolderWatcherConfigFile($"{Environment.CurrentDirectory}/{this.configName}"); }