Re: Listview and threaded filecopy

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



John,

That's the thing, why pass it another entry? Why not create the list of
files to copy, and then pass that list to a method on another thread? Then,
on the other thread, cycle through the list and perform the file copy.

So basically, create a method called CopyFolders which you pass a
Dictionary<string, string> (where the key is the source, and the value is
the destination) and then pass that as your thread routine.

Then, in CopyFolders, enumerate through the keys, and get the values,
calling CopyFolder (which you would change to take a source/destination
parameter) for each key/value pair.

Having multiple threads perform a file copy probably isn't going to give
you much of a performance boost, so one thread is appropriate here, as you
want to keep the UI active.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"John Rogers" <johnrogers2345@xxxxxxx> wrote in message
news:um277ACaIHA.3828@xxxxxxxxxxxxxxxxxxxxxxx
Thats where I am lost, how do you know when the thread is finished
so you can pass it another entry to process. Can you provide me with
a small example?


Thanks

John-


"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:OWfuD5BaIHA.1532@xxxxxxxxxxxxxxxxxxxxxxx
John,

You are just passing the currently selected item. What you need to do
is cycle through all the items before you create the new thread, and pass
all the sources and all the destinations (an array, or dictionary would
be good here) and then cycle through those in your worker thread.




.



Relevant Pages

  • Re: fewer rules of the road...
    ... and cause major backups on the entry roads. ... The entire light system could be triggered by detecting a stationary vehicle ... the light cycle gives the last car ...
    (rec.motorcycles.harley)
  • Re: adjusting an image
    ... directions by zeros, so we don't need to worry about edge effects. ... each entry x of A, we look at a 3x3 window centred at x, see whether ... does it always terminate in a cycle of length ... You're asking about periodic patterns in ...
    (sci.math.research)
  • Re: One way streets
    ... things on the cheap and forget about painting in the cycle lane. ... no entry and one way signs and then just leave them to it. ... As long as drivers know contraflow cycling is legal, there is little conflict, with traffic in opposite directions passing at gaps in the parked cars. ...
    (uk.rec.cycling)
  • Re: Listview and threaded filecopy
    ... Thats where I am lost, how do you know when the thread is finished ... so you can pass it another entry to process. ... good here) and then cycle through those in your worker thread. ...
    (microsoft.public.dotnet.languages.csharp)