I have a simple app using FileSystemWatcher running as a Windows Service. Files are saved to the directory via an excel VB Macro with
ActiveWorkbook.SaveAs Filename:= "pathToSaveTo"
On creation of a new file, the watcher calls a method to process the file
void watcher_FileCreated(object sender, FileSystemEventArgs e)
{
while (true)
{
if (FileUploadComplete(e.FullPath))
{
this.ProcessOneFile(e.FullPath, e.Name);
break;
}
}
}
The watcher app never registers an event when this happens but manually removing and re-adding the files to folder causes the event to be raised.
Does anybody know how I can get the expected behaviour when a file is saved to the directory?