I am manually copying some folders and files through C#, and I want to show the user that something is actually going on. Currently, the program looks as if its frozen, but it is actually copying files.
I would think there is already a built-in dialog or form that shows the process, similar to copying/moving files in windows explorer. Is there anything like that available, or will I have to create everything from scratch?
Also, would this be the best method to show the user that something is actively going on?
Thanks for the help!
There is one built in from the Microsoft.VisualBasic.FileIO Namespace. Don't let the name scare you, it is a very underrated namespace for C#. The static class FileSystem
has a CopyFile
and CopyDirectory
method that has that capability.
FileSystem Members
Pay Close attention to the UIOption
in both the CopyFile
and CopyDirectory
methods. This emulates displays the Windows Explorer copy window.
FileSystem.CopyFile(sourceFile, destinationFile, UIOption.AllDialogs);
FileSystem.CopyDirectory(sourceDirectory, destinationDirectory, UIOption.AllDialogs);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With