编写软件时,常需实现程序间协作或对文件变动进行监听并响应。以下以监控记事本文件修改为例,说明如何实时捕捉外部文件变化并触发相应操作。 1、 启动VS,选择VisualC模板新建一个WPF应用项目。将项目命名为FileSystemWatcherTest,设置保存路径后点击确定 ...
1、 创建FileSystemWatcher实例并配置其属性参数。 2、 Path属性用于设置需监控的文件夹路径。 3、 Filter属性用于设置需监控的文件类型,例如*.txt可监控文本文件;若要监控特定文件,直接指定文件名即可。 4、 EnableRaisingEvents用于控制是否触发变更事件。 5 ...
I have a directory on a remote machine into which client computers will place files, I need to write code to respond to the creation of those files, and the best way I could come up with in C# was ...