webservice async call vs backgroundworker?
-
hello guys! i'm having some issue figuring out what to use for my application.i'm developing a desktop application pulling most of its data from websevices.I display the data which can be huge with a datagrid. i have a webservice datasource and bind that datasource to the grid. Now i want to give better user experience and feedback to users.The method i found online for the backgroundworker with the progressbar is not satisfactory enough.Actually they use loops to give the reportprogress the percentage to show while in my implementation i can't put webservice calling into a loop.I'll like to use the webservice async call with the progress bar but then i don't know how to update the progress bar to display the appropiate percentage.So if anybody can point me to a ressource or a workarround i'll be more than glad.I 'm open to suggestion so please let me know what you think. Thanks for reading this.
eager to learn
-
hello guys! i'm having some issue figuring out what to use for my application.i'm developing a desktop application pulling most of its data from websevices.I display the data which can be huge with a datagrid. i have a webservice datasource and bind that datasource to the grid. Now i want to give better user experience and feedback to users.The method i found online for the backgroundworker with the progressbar is not satisfactory enough.Actually they use loops to give the reportprogress the percentage to show while in my implementation i can't put webservice calling into a loop.I'll like to use the webservice async call with the progress bar but then i don't know how to update the progress bar to display the appropiate percentage.So if anybody can point me to a ressource or a workarround i'll be more than glad.I 'm open to suggestion so please let me know what you think. Thanks for reading this.
eager to learn
Well it depends on whether you have one web service call through which you get all your data or you have multiple separate web service calls to get your data. In the first case it won't be easy to update progress as web service needs to get the whole XML data before it can be parsed etc etc. It can be asynchronous but without progress updates. In second case BackgroundWorker is really suitable here. You do not need any loops as it is shown here http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]. You simply call ReportProgress() method to update current progress between your web service calls and handle ProgressChanged events to update progress bar. Hope this helps somehow.
Vitaliy Tsvayer Tikle
-
Well it depends on whether you have one web service call through which you get all your data or you have multiple separate web service calls to get your data. In the first case it won't be easy to update progress as web service needs to get the whole XML data before it can be parsed etc etc. It can be asynchronous but without progress updates. In second case BackgroundWorker is really suitable here. You do not need any loops as it is shown here http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]. You simply call ReportProgress() method to update current progress between your web service calls and handle ProgressChanged events to update progress bar. Hope this helps somehow.
Vitaliy Tsvayer Tikle
-
Thanks vitaliy.Your suggestion helps but for some reason the progress bar is not updated at all since i have only one web service per form.Thank any way.
eager to learn
Well, as I said it is not easy to do with only one web service call, but possible: one option is to implement Soap Extension, for instance like shown in http://www.codeproject.com/KB/webservices/Soap_Extension_Progress.aspx[^]
Vitaliy Tsvayer Tikle