Timer Event Not Firing in SystemFileWatcher...

  • Thread starter Thread starter Mike Andrews
  • Start date Start date
M

Mike Andrews

Guys,

I've got a bit of a problem...

I'm using a SystemFileWatcher to watch for new files that get built in a
directory. The problem I have is that the file being written is about 4mb in
size. It's being written from one server to another server the file watcher
is running on. What I've been trying to do is fire off a timer, in the
Change event of the SystemFileWatcher, to try to open the file to see if
it's done being written to or not; catching an exception if not and waiting
for the next tick event. However, the timer will not fire. I've tried
Timer.Start() and Timer.Enabled = True, I've tried both, but to no avail.
Does anyone know if this is a bug or not or if I'm doing this wrong?

Also, I was using the event from the SystemFileWatcher to accomplish the
same task, but occasionally, it wouldn't fire one last time when the file
was completed, so I never could accomplish the task I need to accomplish.

Does anyone have any better ideas on how to accomplish this, or know if you
can use a timer inside the Change event of the SystemFileWatcher class?

Thanks,

Mike
 
Mike Andrews said:
I'm using a SystemFileWatcher to watch for new files that get built in a
directory. The problem I have is that the file being written is about 4mb
in
size. It's being written from one server to another server the file
watcher
is running on. What I've been trying to do is fire off a timer, in the
Change event of the SystemFileWatcher, to try to open the file to see if
it's done being written to or not; catching an exception if not and
waiting
for the next tick event. However, the timer will not fire. I've tried
Timer.Start() and Timer.Enabled = True, I've tried both, but to no avail.
Does anyone know if this is a bug or not or if I'm doing this wrong?

Maybe setting the filesystemwachter's 'SynchronizingObject' property to the
form the component is placed on will solve the problem.
 
Thanks alot.

That workd!

Later,
Mike

Herfried K. Wagner said:
Maybe setting the filesystemwachter's 'SynchronizingObject' property to the
form the component is placed on will solve the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top