I would like to know how to make something which will work like that. Since Java 1.7 I could use WatchService
but how to do that in C#? I would like to make this method blocking, not a usual event, so it waits forever until new file will come up.
while(isANewFileInDirectory(path)){
doSomeCode();
}
EDIT:
FileSystemWatcher watcher = new FileSystemWatcher(".\\Screenshots");
watcher.Created += watcher_Created;
void watcher_Created(object sender, FileSystemEventArgs e) {
System.Diagnostics.Debug.WriteLine("fasuigfasuigf423432FSDFSAasuigf");
sendResponse(e.FullPath);
}