using System.IO;

//
首先实例化一个对象 FileSystemWatcher watcher = new FileSystemWatcher(); //设置监听路径 watcher.Path = Path.Combine(System.Environment.CurrentDirectory, @"eventTest\"); //只监听这一个文件,当礼品目录修改完毕后对此文件进行修改,由此触发监听事件 watcher.Filter = "EventConfig.ini"; watcher.NotifyFilter = NotifyFilters.LastWrite; //启用监听,如果不设置则不会触发事件 watcher.EnableRaisingEvents = true; //设置监听触发事件 watcher.Changed += new FileSystemEventHandler(watcher_Changed);

private void watcher_Changed(object sender, FileSystemEventArgs e) { WatchingEvent(EventConfigHelper.instance.WatchingNum); }

 

相关文章:

  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-30
  • 2021-07-22
  • 2021-11-03
  • 2021-08-24
  • 2021-09-30
  • 2022-12-23
  • 2021-09-17
相关资源
相似解决方案