zoukankan      html  css  js  c++  java
  • wp7 手机归属地查询

    ps:之前一直看卤面网,看博客园里强人关于wp7开发介绍等也快大半个月了,不得不说实践是检验真理的唯一标准,还得自己动手做,这个是我做的第一个wp7小程序:手机归属地查询。不废话,先上图:

    此应用拥有3个功能,查询手机归属地、拨号、保存号码。应用很简单,感觉wp7美工很重要,可惜我就会点ps。

    查询功能:

    这里查询所用的服务端为webxml提供的webservice。

    http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx

    添加webservice

    后台代码:

     private void btnseach_Click(object sender, RoutedEventArgs e)
            {
                progressBar1.Maximum = 0;
                progressBar1.IsIndeterminate = true;
                progressBar1.Visibility = Visibility.Visible;
                JudgeInfo();
                progressBar1.Maximum = 10000;

                for (int i = 1; i <= 10000; i++)
                {
                    progressBar1.Value++;
                }
            }

    这里用了一个progressbar来显示查询过程。

     public void JudgeInfo()
            {
                string phoneNumber = txtphone.Text;
                if (string.IsNullOrEmpty(phoneNumber))
                {
                    MessageBox.Show("请 输 入 您 的 电 话 号 码!");
                    txtphone.Text = "";
                    progressBar1.Visibility = Visibility.Collapsed;
                    progressBar1.IsIndeterminate = false;
                    return;
                }
                else if (phoneNumber.Length < 11)
                {
                    MessageBox.Show("您 输 入 的 手 机 号 码 不 合 规 范,请 重 新 输 入 !");
                    txtphone.Focus();
                    txtphone.Text = "";
                    return;
                }
                //信息合法则直接显示
                GetPhoneNumberInfo();
            }

       public void GetPhoneNumberInfo()
            {
                try
                {
                    MobilePhone.MobileCodeWSSoapClient mobilPhone = new MobilePhone.MobileCodeWSSoapClient();
                    mobilPhone.getMobileCodeInfoCompleted += new EventHandler<MobilePhone.getMobileCodeInfoCompletedEventArgs>(mobilPhone_getMobileCodeInfoCompleted);
                    mobilPhone.getMobileCodeInfoAsync(txtphone.Text, "");
                }
                catch
                {
                    MessageBox.Show("请 确 保 您 的 网 络 畅 通");
                }
            }

    打电话代码:

     private void btncall_Click(object sender, RoutedEventArgs e)
            {
                PhoneCallTask task = new PhoneCallTask();
                task.DisplayName = "号码";
                task.PhoneNumber = txtphone.Text;
                task.Show(); 
            }

    保存电话代码

     private void btnsave_Click(object sender, RoutedEventArgs e)
            {
                SavePhoneNumberTask task = new SavePhoneNumberTask();
                task.PhoneNumber = txtphone.Text;
                task.Show(); 
            }

    代码下载链接:http://download.csdn.net/detail/huangyuancao/4281908

    参考博客http://www.cnblogs.com/wildfeng/archive/2012/03/21/2409174.html

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    初识敏捷开发
    【C#】HTTP请求GET,POST(远程证书失效)
    登录验证的js;JS验证邮箱 验证密码
    字符串验证类
    ASP.NET获取客户端信息,获取客户端IP等等
    HttpCookie类
    js获取页面的来源页
    JS URL传中文参数引发的乱码问题
    SQL Server 2008删除或压缩数据库日志的方法
    数据库SQL优化大总结之 百万级数据库优化方案
  • 原文地址:https://www.cnblogs.com/newstart/p/2486958.html
Copyright © 2011-2022 走看看