Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. webservice async call vs backgroundworker?

webservice async call vs backgroundworker?

Scheduled Pinned Locked Moved C#
cssvisual-studiodesignbeta-testinghelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    highjo
    wrote on last edited by
    #1

    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

    V 1 Reply Last reply
    0
    • H highjo

      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

      V Offline
      V Offline
      Vitaliy Tsvayer
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • V Vitaliy Tsvayer

        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

        H Offline
        H Offline
        highjo
        wrote on last edited by
        #3

        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

        V 1 Reply Last reply
        0
        • H highjo

          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

          V Offline
          V Offline
          Vitaliy Tsvayer
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups