看起来,FileSystemWatcher 不止一次触发事件。这是我的设置;
watcher = new FileSystemWatcher();
watcher.Path = @"D:\testSpace";
watcher.InternalBufferSize = 1024*64;
watcher.Deleted += Triggered;
watcher.Changed += Triggered;
watcher.Created += Triggered;
watcher.Error += ErrorOccured;
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
如果更改文档,则会触发两次 Document changed 事件。
除非在文件夹下创建新文件,否则不会触发新文件夹创建事件。
未触发已删除事件(也尝试使用 shift delete)
你们知道解决这些问题的方法吗?