Solved

Display name of file being copied to UI using copyDir

Posted on 2011-09-02
3
278 Views
Last Modified: 2013-12-17
Experts,

I have a C#  Win Form app that uses a background worker and copyDir to copy all the contents of one directory to another. When debugging the Output console prints a nice list of the current file being copied. I'd like to display this info to the user so they can see the progress in addition to the progress bar I'm using. Currently in my backgound worker DoWork method I have the following:

try
            {
                copyDir mycopy = new copyDir();
                myAnswer = mycopy.CopyAll(dir1, dir2);
               
            }
            catch
            {
                bwWork.CancelAsync();
                MessageBox.Show("Could not find thumb drive", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

Can this be done?

Thanks!
0
Comment
Question by:lateapex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
ID: 36477567
what is the definition of the CopyDir class ?

it must be writing to Debug and probably can be moded to Copy to a status bar or similar.
(copyDirectory is part of System namespace.)
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 36477588
on the assumption you are using http://channel9.msdn.com/Forums/TechOff/257490-How-Copy-directories-in-C

you will see it has a Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name);

that writes the name of each file to the output window. If this were a console (ir command prompt app), you would see this is final product. But would be hard (at least for me) to modify so that it shows in a progress dialog.

http://www.codeproject.com/KB/files/Copy_files_with_Progress.aspx may be more what you are seeking as it appears to allow use of a special progress dialog that can display the full path and filename being actioned.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question