Re: Listview and threaded filecopy
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Feb 2008 13:07:29 -0500
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.
.
- References:
- Listview and threaded filecopy
- From: John Rogers
- Re: Listview and threaded filecopy
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Listview and threaded filecopy
- From: John Rogers
- Listview and threaded filecopy
- Prev by Date: bytes To Hex
- Next by Date: Re: Why northwind linq code has unused methods
- Previous by thread: Re: Listview and threaded filecopy
- Next by thread: Re: Concatenating IEnumerable?
- Index(es):
Relevant Pages
|