Getting started with TouchStack

Handling basic HTTP authentication challenges

Passing additional state information

About one-way service requests

Receiving notifications about the request progress

Sometimes you may want to receive notifications about the progress of your request, be it the upload progress (sending the request to the server), or the download progress (receiving the response from the server). You can do so by listening the two events dedicated to fulfilling this purpose:

  • the ServiceProgress event - provides information about the download progress;
  • the ServiceUploadProgress event - provides information about the upload progress.

Here's a code snippet that shows how they can be used:

service.ServiceProgress += delegate(object sender, ServiceProgressArgs args) {
	progressView.SetProgress((float)args.Progress, true);//args.Progress is between [0,1]
	progressLbl.Text = string.Format("Download progress: {0}%", args.Progress * 100);
};

service.ServiceUploadProgress += delegate(object sender, ServiceProgressArgs args) {
	progressView.SetProgress((float)args.Progress, true);//args.Progress is between [0,1]
	progressLbl.Text = string.Format("Upload progress: {0}%", args.Progress * 100);
};

Also, be sure to check out the dedicated example from the latest source code distribution.

-=-

Last edited Dec 12, 2011 at 10:16 AM by alexandruboia, version 9

Comments

No comments yet.