Silverlight Project Note 6:LINQ differential set, intersection & Check network connection status & overloaded constructor Reuse window

Source: Internet
Author: User
Tags silverlight

I. Using LINQ to find difference sets, intersections

Usage scenarios:

Need to obtain user data from the data center, and with this as the standard, synchronize the user information of the system, delete the redundant users in the system, the missing users to add operations, update the information users to edit the operation updates.

Therefore, we need to compare the data center and the existing user information in the system into three parts:

(1) LINQ collection, find the user data that needs to be deleted, delete it (username is a unique value field).

This method is used by except.

(2) using the Intersect method provided by LINQ, the intersection of two user collections is obtained, and the Traverse check is updated.

(3) Again take the difference set, but this time is the new user information collection except existing user information, get the data collection that needs to be added, perform the add operation.

Two. Check the network connection status

The general network Request method returns the status information for the connection, such as nsurlconnection in iOS (void) connection: (Nsurlconnection *) connection Didreceiveresponse :(nsurlresponse*) Response "(Of course it is now recommended to use the third party libraries such as nsurlsession or afnetworking)

C # Certainly also provides a similar approach, namely Getresponseasync, to get the requested HTTP code to be judged.

It is important to note that you should also make an input validation of the URL address input box before this, because it is not possible to enter a URL address.

For ArcGIS Dynamic service Arcgisdynamicmapservicelayer and slicing service Arcgistiledmapservicelayer, You can also do a simple service validation by initializationfailed this method.

three. Overloaded Constructor Reuse window

Usage scenarios:

You need to create roles and edit roles, the Action window displays exactly the same information, the difference is that you cannot modify role names when editing role information, and database interactions are slightly different.

So you can just draw a window and do different things for different scenes. By overloading the constructor (the constructor that corresponds to the edit operation needs to pass in the role information), and set a field identifier for easy differentiation.

For the display in the window can be edited, the IsReadOnly property of the input box is bound, the edit operation when the property value is true, read-only;

For the window name, also do the binding processing, according to different operations to display different names;

For database interaction differences, it is also possible to classify the differentiated parts by judging the identifier CanEdit.

Silverlight Project Note 6:LINQ differential set, intersection & Check network connection status & overloaded constructor Reuse window

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.