FileSystemWatcher 事件触发问题
看起来,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;
如果更改文档,文档更改事件会触发两次。
除非在文件夹下创建新文件,否则不会触发新文件夹创建事件。
除非在文件夹下创建删除的事件未触发(也尝试使用shift删除)
你们知道解决这些问题的方法吗?
It seems like , FileSystemWatcher triggers events more than once. Here is my settings ;
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;
If you change a document , Document changed event triggered twice.
New folder created event does not get triggered unless a new file created under the folder.
Deleted event not fired ( tried using shift delete as well)
do you guys know any work around for these issues ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FileSystemWatcher:
链接中描述了第一个问题的解决方案。
FileSystemWatcher:
The solution to your 1st issue is described in the link.