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

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    Android数据适配器(Adapter)优化:高效ViewHolder
    touch-css-margintop问题
    抽奖
    scroll03-节日两侧的渲染
    scroll02-滚动时显示当前主题菜单状态
    浏览器背景色半透明效果。
    scroll01-滚动到一定高度时,显示导航栏
    layout01-在布局ul时,给li设置margin-right的时候,每行的最后一个li有margin-right 导致ul 看上去不居中的问题
    placehoder兼容
    day03
  • 原文地址:https://www.cnblogs.com/newstart/p/2486958.html
Copyright © 2011-2022 走看看