>Oh yea, details... <g> I ought to know better. It's a WinForms app. This code is in the constructor after the InitializeComponents() line:
>
>try
>{
> System.IO.FileSystemWatcher watcher = new System.IO.FileSystemWatcher();
> watcher.Path = this.txtWatchForStartFile.Text.Trim();
> watcher.Filter = "start.txt";
> watcher.Created += new System.IO.FileSystemEventHandler(OnStartFileAppeared);
> watcher.EnableRaisingEvents = true;
>}
>catch (Exception err)
>{
> MessageBox.Show(err.Message + "\n\nStack: " + err.StackTrace,
> "Can Not Watch for start.txt file - Use GO NOW button");
>}
>
>And the method code...
>public void OnStartFileAppeared(object source, System.IO.FileSystemEventArgs e)
>{
> this.btnGO_Click(source, e);
>}
Mike,
Well, the code looks fine. I was thinking that there might be some static methods in there somewhere, but this is not the case. I did some research on the FileSystemWatcher, and it seems that the general concensus is that it is only as reliable as the operating system that initially fires the events.
Perhaps the answer is to create one windows service that watches the directory. You could use MSMQ to notify the application, or hook the application's events to the windows service.
I'm sorry that I haven't been more helpful.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement