Hi!
I have a directory and file search class that I would like to call in an
asynch manner. The class is implemented such that whenever a matching item
is found (directory, file, file content) an appropriate event is triggered.
The application/class using it subscribes to the events (to update UI or log
to file or whatever) and the event args include a Cancel parameter that they
can set to true to abort the search.
I have a couple of questions:
1. Where do I implement the threading? In the app/class calling the
filesearcher class or in the filesearcher class directly?
2. How do I make the events synchronuos? I need to wait for their completion
since I need the Cancel parameter.
3. Is there an alternative to using a Cancel parameter in the event args?
4. If implementing threading in the filesearcher class is the best way to
proceed, can I still maintain the synchronuos behavior already implemented?
Coming from the Delphi world, I have had little problems getting to grips
with .Net and C# (there are a lot of similarities), but .Net threading is
one of those things that I can't quite get my head around so I am looking
forward to your suggestions and ideas.
--
Regards, Peter