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 !!