I’ve been stuck with this problem for around two days now,
and have been trawling the forums looks for help.
Any help would be great.
I have a windows form application which calls external
applications, including commandline calls to subversion.
I have a rich textbox on my forum where I redirect the
output from cmd to. Everything works great, but the form freezes and the
textbox does not show until I do a messagebox.show or something similar. I have
come to the conclusion that I need to do the external processes on a worker
thread. To be honest I have not got much further than that.
I have a function called commandLine() which takes various
parameters such as command, working dir. etc. im thinking that I should place
this on a separate thread but not sure how to go about it as within this
function I redirect the output to another function which deals with putting the
text into the rtb, and a text file.
I have been looking at the threading and the
backgroundworker, but have no idea how to get started at all!
Any advice on how to get started, hints and tips, use
threading or backgroundworker would be great. Just a quick summary:
Thread needs to take multiple parameters and pass various
string values back to the form thread.
Hope this makes sense!
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
I'm not sure on how much help I will be since I am confused on the exact question; however, here are a few things that came to mind:
- You can invoke delegates asynchronously via BeginInvoke() and EndInvoke which will allow you to pass any number of strongly-type parameters to the function.
- You can use the CLR ThreadPool object (which will save you the manual) work of creating threads
- You can of course create threads
- You can use the background worker
I may be able to help out further if you supply more details.
Carl SchraderPosted Jan 26, 2009, 10:47 PM
Alex,
I'm not sure on how much help I will be since I am confused on the exact question; however, here are a few things that came to mind:
- You can invoke delegates asynchronously via BeginInvoke() and EndInvoke which will allow you to pass any number of strongly-type parameters to the function.
- You can use the CLR ThreadPool object (which will save you the manual) work of creating threads
- You can of course create threads
- You can use the background worker
I may be able to help out further if you supply more details.
Carl
Jan MontanoPosted Jan 26, 2009, 10:21 PM
BackgroundWorker Tutorial - C#