private static void uploaderConfigWatcher_Changed(object sender, FileSystemEventArgs e) { if (!uploaderConfigWatcherTimer.IsDuplicateEvent(e.FullPath)) { Action onCompleted = () => ReloadUploadersConfig(e.FullPath); Helpers.WaitWhileAsync(() => Helpers.IsFileLocked(e.FullPath), 250, 5000, onCompleted, 1000); uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(e.FullPath); } }
private static void uploaderConfigWatcher_Changed(object sender, FileSystemEventArgs e) { if (!uploaderConfigWatcherTimer.IsDuplicateEvent(e.FullPath)) { SynchronizationContext context = SynchronizationContext.Current ?? new SynchronizationContext(); Action onCompleted = () => context.Post(state => ReloadUploadersConfig(e.FullPath), null); Helpers.WaitWhileAsync(() => Helpers.IsFileLocked(e.FullPath), 250, 5000, onCompleted, 1000); uploaderConfigWatcherTimer = new WatchFolderDuplicateEventTimer(e.FullPath); } }