Copy/Move with reporting progress

Mar 12, 2014 at 4:34 PM
Can you give me an example how to use your copy/move method with the
CopyMoveProgressCallback and UserProgressData to report progress from the BackgroundWorker?
Mar 13, 2014 at 9:50 AM
Mar 13, 2014 at 3:32 PM
According to the link this should work but File.Copy is not happy with the Callback.
File.Copy(source, destination, CopyOptions.None, true, new CopyMoveProgressCallback(CopyProgressHandler), null);
private CopyMoveProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyMoveProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData)
            switch (reason)
                case CopyMoveProgressCallbackReason.ChunkFinished:                    
                    return m_bCancel ? CopyMoveProgressResult.Cancel : CopyMoveProgressResult.Continue;
                    return CopyMoveProgressResult.Continue;
Mar 15, 2014 at 6:02 PM
Edited Mar 15, 2014 at 7:04 PM
I think I figured out callback but i can not figure out what kind of object is userProgressData
File.Copy(sourceFile, destFile, CopyOptions.None, true, myCallback, userProgressData);
Mar 15, 2014 at 8:08 PM
userProgressData: "The argument to be passed to the callback function. This parameter can be null."

So if your callback function doesn't require any data, just supply null.