diff --git a/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs b/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs index ba2d0021bc3..93e1255d717 100644 --- a/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs +++ b/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs @@ -60,12 +60,13 @@ public static void UploadFileInBackground2(string address, string fileName) client.UploadFileCompleted += new UploadFileCompletedEventHandler(UploadFileCallback2); // Specify a progress notification handler. - client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressCallback); + client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressCallback2); client.UploadFileAsync(uri, "POST", fileName); Console.WriteLine("File upload started."); } // + // // private static void UploadFileCallback2(Object sender, UploadFileCompletedEventArgs e) { @@ -73,6 +74,17 @@ private static void UploadFileCallback2(Object sender, UploadFileCompletedEventA Console.WriteLine(reply); } // + + private static void UploadProgressCallback2(object sender, UploadProgressChangedEventArgs e) + { + // Displays the operation identifier, and the transfer progress. + Console.WriteLine("{0} uploaded {1} of {2} bytes. {3} % complete...", + (string)e.UserState, + e.BytesSent, + e.TotalBytesToSend, + e.ProgressPercentage); + } + // // // Sample call: UploadFileInBackground("http://www.contoso.com/fileUpload.aspx", "data.txt") diff --git a/xml/System.Net/WebClient.xml b/xml/System.Net/WebClient.xml index 36d6b64a19f..2c3f351a0d0 100644 --- a/xml/System.Net/WebClient.xml +++ b/xml/System.Net/WebClient.xml @@ -7163,7 +7163,7 @@ internal class MyWebClient : WebClientProtocol The following code example shows an implementation of a handler for this event. [!code-cpp[NCLWebClientAsync#42](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#42)] - [!code-csharp[NCLWebClientAsync#42](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#42)] + [!code-csharp[NCLWebClientAsync#44](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#44)] [!code-vb[NCLWebClientAsync#42](~/snippets/visualbasic/VS_Snippets_Remoting/NCLWebClientAsync/VB/asyncmethods.vb#42)] ]]>