|
-
Nov 21st, 2011, 03:04 PM
#1
Thread Starter
Hyperactive Member
-
Nov 21st, 2011, 06:46 PM
#2
Re: Help me understand the code (callbacks mainly)
Just had a quick look. Change the return from void to CopyFileCallbackAction to match the delegate and the callback. The return you provide gives you some control over the copy which you can read up on in the documentation.
edit: windows data types
Last edited by Milk; Nov 21st, 2011 at 06:50 PM.
W o t . S i g
-
Nov 22nd, 2011, 03:06 PM
#3
Thread Starter
Hyperactive Member
Re: Help me understand the code (callbacks mainly)
 Originally Posted by Milk
Just had a quick look. Change the return from void to CopyFileCallbackAction to match the delegate and the callback. The return you provide gives you some control over the copy which you can read up on in the documentation.
edit: windows data types
I tried changing the type to CopyFileCallBackAction, but it still gives the same error 
There must be something else in the code that needs a change
-
Nov 22nd, 2011, 04:20 PM
#4
Re: Help me understand the code (callbacks mainly)
It works for me, this is the code I used...
Code:
static void Main(string[] args)
{
AdvancedFileHandling.CopyFile(@"c:\test", @"c:\testCopy", CopyFileOptions.None, ProgressChanged);
}
static CopyFileCallbackAction ProgressChanged(string source, string destination, object state, long totalFileSize, long totalBytesTransferred)
{
Console.Write('.');
return CopyFileCallbackAction.Continue;
}
I made ProgressChanged static because I called CopyFile() from a static method.
-
Nov 23rd, 2011, 01:36 PM
#5
Thread Starter
Hyperactive Member
Re: Help me understand the code (callbacks mainly)
I tested again and now it worked! VS must have hung up or something before since the error didn't disappear.
So thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|