In my WPF app, I want to copy files using Copy Files Dialog builded in windows. I have found I can do it by: Microsoft.VisualBasic.FileIO.FileSystem.CopyFile, but the problem is I don't know how to copy many files using this dialog. The same as windows provides. You may select SOME files from a folder, copy them, and one Copy Files Dialog 开发者_运维问答is shown. How can I achieve it - copying many files with ONE dialog, one after another?
You can use the native SHFileOperation
provided by windows, have a look here:
C# does Shell, Part 2
then on MSDN you can also find this about Windows Vista:
IFileOperation Interface
Exposes methods to copy, move, rename, create, and delete Shell items as well as methods to provide progress and error dialogs. This interface replaces the SHFileOperation function.
Those are exactly the Dialogs built in windows as you asked, it requires a bit of work to use them but is the only way you are sure that moving your application to another operating system you will always use the latest features (for windows 8 improvements on those dialogs see here: Windows 8 Explorer: improved copy, delete, and conflict resolution)
精彩评论