WP7 mobile phone number attribution Query

Source: Internet
Author: User

I am a beginner in WP7 development. I also read a lot about WP7 in the garden.ArticleBut learning is not just about reading. What's important is to do it yourself.

I personally think that mobile development is a trend. We need to seize the opportunity. (This is my personal opinion. What do you think of it ?).

I have no artistic skills, and the interface must be ugly. I hope you will not abandon it .:

Functions include querying local numbers, querying input numbers, dialing numbers, and saving numbers.

Below are various functionsCodeImplementation:

1. Select a local number for query

 

/// <Summary> ///Select Local number/// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param>Private voidBtnchoose_click (ObjectSender,RoutedeventargsE ){PhonenumberchoosertaskTask =NewPhonenumberchoosertask(); Task. Completed + = (_ s, _ e) => {If(_ E. Error =Null) Txtnumber. Text = _ E. phonenumber ;}; task. Show ();}

2. query the region

 /// <Summary> /// Query the region  /// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param>  Private void Btnsearch_click ( Object Sender, Routedeventargs E ){ If (! Checknumber ()){ MessageBox . Show ( "The number you entered is incorrect ." ); Return ;} Servicenumber. Mobilecodewssoapclient Client = New Servicenumber.Mobilecodewssoapclient (); Client. getmobilecodeinfoasync (txtnumber. Text. Trim (), "" ); Client. getmobilecodeinfocompleted + = (_ s, _ e) => { Try { If (_ E. Error = Null ) This . Txtmsg. Text = _ E. Result. tostring (). substring (12 );} Catch { MessageBox . Show ( "Network error or system exception! " );}};}

3. Call number

/// <Summary> ///Call/// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param>Private voidBtncall_click (ObjectSender,RoutedeventargsE ){If(! Checknumber ()){MessageBox. Show ("The phone number you entered is incorrect .");Return;}PhonecalltaskTask =NewPhonecalltask() {Phonenumber =This. Txtnumber. Text}; task. Show ();}
 
4. Save the number
/// <Summary> ///  Save number  /// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param>  Private void Btnsave_click ( Object Sender, Routedeventargs E ){ If (! Checknumber ()){ MessageBox . Show ( "The phone number you entered is incorrect ." ); Return ;} Savephonenumbertask Task =New  Savephonenumbertask () {Phonenumber = This . Txtnumber. Text}; task. Completed + = (_ s, _ e) => { If (_ E. Error = Null ) MessageBox . Show ( "Saved successfully! " ); Else  MessageBox . Show ( "Saving failed! " ) ;}; Task. Show ();}
 
Simple Functions
Reference blog: http://www.cnblogs.com/wildfeng/archive/2012/03/21/2409174.html
 
WebService address: http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx
 
Source code download: source code
 
The interface is a bit ugly. Thank you !!
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.