[quoted text, click to view] Alex Feinman [MVP] wrote:
> What is in your main thread that dies after the first run? Are you using
> WIndows Application model (main form that is instantiated via
> Application.Run) or did you put together something of your own?
>
> If the MSDN article that you refer to is this one[1], are you following
> the model I use in that article or do you have something quite different?
>
> 1.
http://msdn.microsoft.com/library/en-us/dnnetcomp/html/AutoUpdater.asp >
Hi Alex.
Thanks a lot for the quick response.
Yes, the main thread that dies comes from Application.Run.
And when I say die, I mean that is is killed.
If the app is executed from withing the VS debugger, then I get a remote
connection lost error, and if I'm just executing the app normally, it
just vanishes (actually it is killed, it doesn't appear in the task
manager).
I've used a hybrid of the code the MSDN article uses, because I need to
update a number of files and not just one. For a single file, everything
works fine, but if you want to start a new download after the first has
finished, you must have some sort of control over the operation.
I used ManualResetEvent.WaitOne, and ManualResetEvent.Set when the last
byte was recieved. But as I mentioned in the first post, this didn't
work, as when I used the BegineRead function again, together with invoke
the thread was killed somehow ( but I did managed to pass through
this, by setting a Thread.Sleep(OneCentury) , only to get a glorious
hang in the next pgProgress.Invoke() ).
What I'm actually trying to do is this:
Download a list files that need to be updated.
Start downloading the files one by one, while updating two progress
bars, one reporting total progress and the other one current file
progress. I still believe I'm missing something trivial here.
Anyway, I can provide you with some snippets, when I get back to the
office.
Thanks for the help anyway.