的文檔沒有投票,你可以警告的文件系統的修改,包括與FileSystemWatcher
子目錄。
4類事件:
- 創建
- 更改
- 刪除
- 更名
FileSystemWatcher watcher = new FileSystemWatcher(path);
watcher.IncludeSubdirectories = true;
watcher.Filter = "*.config";
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
watcher.EnableRaisingEvents = true;
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.Deleted += new FileSystemEventHandler(OnDeleted);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
void OnChanged(object source, FileSystemEventArgs e)
{
// Specify what is done when a file is changed, created, or deleted.
Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType);
}
也許這將幫助你... HTTP://www.codeproject.com/Articles/26875/WPF的XmlDataProvider - 雙向-數據綁定 – Jose