Home All Groups Group Topic Archive Search About

Timer Event Not Firing in SystemFileWatcher...

Author
12 Apr 2005 4:29 PM
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

Author
12 Apr 2005 5:11 PM
Herfried K. Wagner [MVP]
"Mike Andrews" <mi***@farpointer.net> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
12 Apr 2005 5:50 PM
Mike Andrews
Thanks alot.

That workd!

Later,
Mike

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:umPskK4PFHA.2132@TK2MSFTNGP14.phx.gbl...
> "Mike Andrews" <mi***@farpointer.net> schrieb:
> > 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.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>