c# - Global Variable not incrementing on callback functions -
After
I am using Webclient to upload data to a server using Async calls,
WebClient WebClient = new webclient (); WebClient.UploadDataAsync (Yuri, "Pt", Buffer, UserToken);
I have linked datepload progress and data uploads related events to the appropriate callback function
// Full webmail uploaded. Upload Data Contains + = New UploadData Provisioning Handler (UploadDataCallback2); // uploaded progress webClient.UploadProgressChanged + = new uploadprogressingthan handler (uploadprogelbackback);
And in the function I am trying to show some message boxes:
// upgrade date progress zero upload progress callback (object sender, Upgrade Progress Changed Event ARG E) {Show the message box (this, "upload progress, x =" + x); X ++; MessageBox.Show (e.BytesSent.ToString ()); } // Full UploadDataCallBlack2 (Object Sender, UploadDataCompletedEventArgsE) on uploaded date {MessageBox.Show (this, "uploaded, x =" + x); X ++; MessageBox.Show (ASCIIEncoding.UTF8.GetString (e.Result)); }
Where x is a global variable, but for some reasons X does not grow, and all message boxes show X = 0.
Anyone The explanation is very much appreciated ..
Oh problem, well apparently the problem is a 2- Parts were a problem, and I hope someone will confirm my conclusion:
Comments
Post a Comment