我想List<string>
使用我的事件传递我的 as 参数
public event EventHandler _newFileEventHandler;
List<string> _filesList = new List<string>();
public void startListener(string directoryPath)
{
FileSystemWatcher watcher = new FileSystemWatcher(directoryPath);
_filesList = new List<string>();
_timer = new System.Timers.Timer(5000);
watcher.Filter = "*.pcap";
watcher.Created += watcher_Created;
watcher.EnableRaisingEvents = true;
watcher.IncludeSubdirectories = true;
}
void watcher_Created(object sender, FileSystemEventArgs e)
{
_timer.Elapsed += new ElapsedEventHandler(myEvent);
_timer.Enabled = true;
_filesList.Add(e.FullPath);
_fileToAdd = e.FullPath;
}
private void myEvent(object sender, ElapsedEventArgs e)
{
_newFileEventHandler(_filesList, EventArgs.Empty);;
}
从我的主要形式我想得到这个列表:
void listener_newFileEventHandler(object sender, EventArgs e)
{
}