我正在尝试监视文件夹(及其子文件夹)的更改。但是,我的处理程序事件永远不会执行。我使用以下代码:
FileSystemWatcher m_Watcher = new FileSystemWatcher();
m_Watcher.Path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/Portal 2 Map Installer/";
m_Watcher.Filter = "";
m_Watcher.NotifyFilter = NotifyFilters.LastAccess |
NotifyFilters.LastWrite |
NotifyFilters.FileName |
NotifyFilters.DirectoryName;
m_Watcher.IncludeSubdirectories = true;
m_Watcher.Changed += new FileSystemEventHandler(OnFolderChange);
m_Watcher.EnableRaisingEvents = true;
请帮忙!