Code:
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(path, "*.exe");
fileSystemWatcher.IncludeSubdirectories = true;
fileSystemWatcher.Created += new FileSystemEventHandler(fileSystemWatcher_Created);
fileSystemWatcher.Deleted += new FileSystemEventHandler(fileSystemWatcher_Deleted);
fileSystemWatcher.EnableRaisingEvents = true;
创建事件工作正常,但删除事件仅在删除目录/或 Exe 时触发SHIFT。但正常删除(移至回收站)不工作/触发事件!
如何解决问题?
我知道这是一个老问题,但我通过将 FileName 添加到 FileSystemWatcher 对象的 NotifyFilter 属性来解决这个问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)