手机归属地查询源码
先上图应用地址:http://115.com/file/dp7nnu54#
SearchPhone.xap大家可以去下载。这个应用已经通过了微软的认证。
此应用拥有3个功能,查询手机归属地、拨号、保存号码。应用很简单,大部分时间都画在了P图和设计页面上了。
拨打电话代码。
1: //打电话
2: private void Call_Click(object sender, RoutedEventArgs e)
3: {
4: if (CheckText())
5: {
6: PhoneCallTask task = new PhoneCallTask();
7: task.DisplayName = "此号码";
8: task.PhoneNumber = PhoneNumber.Text;
9: task.Show();
10: }
11: }
保存号码代码。
1: //保存手机号码
2: private void Save_Click(object sender, RoutedEventArgs e)
3: {
4: if (CheckText())
5: {
6: SavePhoneNumberTask task = new SavePhoneNumberTask();
7: task.PhoneNumber = PhoneNumber.Text;
8: task.Show();
9: }
10: }
这里查询所用的服务端为webxml提供的webservice。
http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx
代码如下:
1: private void Search_Click(object sender, RoutedEventArgs e)
2: {
3: if (CheckText())
4: {
5: l.Show(this, "查找中......");//自定义的加载效果
6: client.getMobileCodeInfoAsync(PhoneNumber.Text.ToString(), "");
7: client.getMobileCodeInfoCompleted += new EventHandler<MobileService.getMobileCodeInfoCompletedEventArgs>(client_getMobileCodeInfoCompleted);
8: }
9: }
10: void client_getMobileCodeInfoCompleted(object sender, MobileService.getMobileCodeInfoCompletedEventArgs e)
11: {
12: if (e.Error == null)
13: {
14: string msg = e.Result;
15: try
16: {
17: ShowMsg.Text = msg.Substring(12);
18:
19: }
20: catch (Exception)
21: {
22:
23: MessageBox.Show("网络出现问题,或者是手机号码错误");
24: }
25: }
26: else
27: {
28: MessageBox.Show("网络出现问题,或者是手机号码错误");
29: }
30: l.Hide(this, "");//自定义的加载效果
31: }
摘自 韩弈风
补充:移动开发 , Windows Phone ,