Silverlight client asynchronous Synchronization

Source: Internet
Author: User

Asynchronous operations can bring a better customer experience, but it also adds to the troubles of developers. Currently, asynchronous operations generated using WebService mainly have the following problems:

  • For Asynchronous fetch, it is best not to make logical judgments in client code.
  • Methods that need to be loaded in order, resulting in reduced code readability.

To address the above issues, I have two solutions based on my existing development experience:

  • There is no relationship between client fetch methods. I use the client-side counting method, that is, to define a global variable, add this variable to 1 in the asynchronous completed method, and determine whether it is equal to the expected number of times of development, if they are equal, all data is loaded.
  • For the number fetch method that must have a certain order, you need to increase the readability of the Code. I will write each fetch method into a single method and input an action delegate. In this way, only one entry needs to be determined during development, and the logic is handed over to the completed processing of each method.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.