Windows Phone 7 Study Notes-common tools (2)

Source: Internet
Author: User

PreviousArticleI don't know how it will happen. The pictures are distorted during uploading. I will share this with you after making the last modification.

This article also introduces two simple gadgets you have written.

Gadgets 1. QQ online query

I don't need to say much about QQ. You can find QQ's invisible friends. Qq itself does not have this function, so it is practical to write this

Functions.

The running result is as follows:

Code:

 Private QQ. Qqonlinewebservicesoapclient Client =Null ; Public Qquery () {initializecomponent (); client = New QQ. Qqonlinewebservicesoapclient (); Initserver (); loaded + = (a, B) => {txtqq. Text = "399858803" ;};} Private void Initserver () {client. qqcheckonlinecompleted + = (a, RE) => { If (Re. Error = Null ) {Txtqqresult. Text =String . Format ( "Current QQ number: {0} \ r \ n {1 }" , Txtqq. Text, re. Result = "Y" ? "Online" : "Processing offline status" );}};} Private void Btnquery_click ( Object Sender, system. Windows. Routedeventargs E ){ If (! String . Isnullorempty (txtqq. Text) {client. qqcheckonlineasync (txtqq. Text );}}

Note: The code is quite simple, that is, using the webserver service provided by a third party. Call the service to query and return the result value.

Gadgets 2. Train Time query

The running result is as follows:

Run the Code:

 Private Train. Traintimewebservicesoapclient Clinet = Null ; Public Trainquery () {initializecomponent (); clinet = New Train. Traintimewebservicesoapclient (); Initserver (); // Txttrain. Text = "2334 "; } Private void Initserver () {clinet. getdetailinfobytraincodecompleted + = (a, RE) => { If (Re. Error = Null ) {Txtresult. Text = Re. Result. nodes [0]. Value ;}};} Private void Btnquery_click (Object Sender, system. Windows. Routedeventargs E ){ // Todo: Add event handler implementation here.  If (! String . Isnullorempty (txttrain. Text) {clinet. getdetailinfobytraincodeasync (txttrain. Text, "" );} Else Clinet. getdetailinfobytraincodeasync ( "" , "" );}

Gadgets 3. IP address query tool

The running result is as follows:

Run the following code:

 Private IP. Ipaddresssearchwebservicesoapclient Client = Null ; Public Ipquery () {initializecomponent (); client = New IP. Ipaddresssearchwebservicesoapclient (); Initserver ();} Private void Initserver () {client. getcountrycitybyipcompleted + = (a, RE) => { If (Re. Error = Null ) {Txtresult. Text = String . Format ( "The current IP {0} is: {1 }" , Txtipaddress. Text, re. Result [1]. tostring ());}};} Private void Btnquery_click ( Object Sender, system. Windows. Routedeventargs E ){ // Todo: Add event handler implementation here.  If (! String . Isnullorempty (txtipaddress. Text) {client. getcountrycitybyipasync (txtipaddress. Text );}}

Gadgets 4. Postal code query tools

The running result is as follows:

Run the following code:

 Private Zip. Chinazipsearchwebservicesoapclient Client = Null ; Public Postcodequery () {initializecomponent (); client = New Zip.Chinazipsearchwebservicesoapclient (); Initserver ();} Private void Initserver () {client. getaddressbyzipcodecompleted + = (a, RE) => { If (Re. Error = Null ) {Txtresult. Text = Re. Result. nodes [0]. Value ;}};} Private void Btnquery_click ( Object Sender, system. Windows. Routedeventargs E ){ // Todo: Add event handler implementation here. If (! String . Isnullorempty (txtpostcode. Text) {client. getaddressbyzipcodeasync (txtpostcode. Text, "" );}}
 
 
The aboveProgramThe code is very simple, as long as the piovt of WP7 is used for sliding left and right. Simple functions but very practical in life. All of them use the webserver service provided by a third party. Each service provides many aspects for our use. For more information about the methods and usage of services, see the http://www.webxml.com.cn/zh_cn/web_services.aspxp here.
 
 
There are also a few unimplemented gadgets in the project. If you are interested, you can download the source code and complete it. In gadgets, there is no page beautification, and implementation is the principle. If your artistic skills are profound, this is where you show your talents.
 
This program is the learning notes in the learning process. It is inevitable that there will be deficiencies in the program.
 
Source code: Http://cid-904fa9b9fc4c059f.office.live.com/self.aspx/Windows%20Phone%207/WP7Demo.zip
 
 
 
 
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.