Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execution of multiple methods on the same worker thread... 1

Status
Not open for further replies.

Logmaster

Technical User
Jan 2, 2006
31
US
Hi,


I have built an application that is doing some automation. The application contains a main form and several workers threads that gather data using HttpWebRequests - Everything works great.

There is only task that is requiring the use of the WebBrowser object. Since I need to simulate some keystrokes and do a few other tasks that are a little bit tricky, I have decided to place a hidden webbrowser on the form and define the task as follows:

1. A worker thread will be created.

2. A short method will call the WebBrowser.navigate method with a URL of the first page that needs to be loaded.

3. Once loading is completed, the DocumentText of the WebBrowser1 will be sent to the worker thread for processing with can take a few minutes.

4. Once the thread will complete the processing, it will signal the main thread. The main thread will load the next page and go back to step2.

5. Once all pages will be processed, the worker thread will get disposed.

I do not want to create a new thread every time I need to process the data I got from the WebBroser. What is the best way to do it?


Thanks,

Joe


 
If I understand you, why not call the worker thread asynchronously, and define a callback delegate.

This will be called when the worker thread is complete, which can trigger the loading of the next document?

 
Thanks for your advice, that did the trick!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top