i am using Webclient to upload data using Async call to a server,
WebClient webClient = new WebClient();
webClient.UploadDataAsync(uri , "PUT", buffer, userToken);
i've attached DatauploadProgress and DatauploadCompleted Events to appropriate callback functions
// Upload Date Completed
webClient.UploadDataCompleted += new
UploadDataCompletedEventHandler(UploadDataCallback2);
// Upload Date Progress
webClient.UploadProgressChanged += new
UploadProgressChangedEventHandler(UploadProgressCallback);
and in the functions i am trying to show some MessageBoxes:
// Upload Date Progress
void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
MessageBox.Show( this,"Upload Progress ,x =" +x);
x++;
MessageBox.Show(e.BytesSent.ToString());
}
// Upload Date Completed
void UploadDataCallback2(object sender, UploadDataCompletedEventArgs e)
{
MessageBox.Show(this, "Upload Done,x =" +x);
x++;
MessageBox.Show(ASCIIEncoding.UTF8.GetString(e.Result));
}
Where x is a global variable, However for some reason x is not getting incremented, and all the message boxes show x=0..
any explanation would be much appreciated..