Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.IO.FileSystemWatcher issue
Message
From
18/06/2004 10:44:30
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00914845
Message ID:
00915052
Views:
15
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform