关注WP 7 好久了,也在网上看牛人写的博客很好,从他们中学到了很多的东西。记录新技术的学习过程,并帮助别人一起学习它。学习的宗旨“一起学习共同进步”;

 

今天写了两个常用的小工具特与大家分享。

 

说明:这个两个小工具都要用到第三方提供的服务。

 

小工具一:手机号归属地查询。

运行结果如下:

 

windows phone 7 学习笔记------常用小工具(一)

代码如下:

private void btnQuery_Click(object sender, RoutedEventArgs e)
        {

            client.getMobileCodeInfoCompleted += new EventHandler<Mobile.getMobileCodeInfoCompletedEventArgs>(client_getMobileCodeInfoCompleted);
            progressBar.Visibility = System.Windows.Visibility.Visible;
            if (tbPhone.Text != "")
            {
                client.getMobileCodeInfoAsync(tbPhone.Text, "");
            }
            else
            {
                MessageBox.Show("电话号不能为空!", "提示", MessageBoxButton.OK);
            }
        }

        void client_getMobileCodeInfoCompleted(object sender, Mobile.getMobileCodeInfoCompletedEventArgs e)
        {

            if (e.Error == null)
            {
                tbDisplayAddress.Text = e.Result;
            }
        }

小工具二:邮政编码查询。

运行结果如下:

 

windows phone 7 学习笔记------常用小工具(一)

代码如下:

void btnQuery_Click(object sender, RoutedEventArgs e)
       {
           client.getAddressByZipCodeCompleted += new EventHandler<ChinaZip.getAddressByZipCodeCompletedEventArgs>(client_getAddressByZipCodeCompleted);
           if (txtPostCode.Text == "")
           {
               txtAddress.Text = "没有联接数据!";
           }
           else
           {
               client.getAddressByZipCodeAsync(txtPostCode.Text, "");
           }
       }

       void client_getAddressByZipCodeCompleted(object sender, ChinaZip.getAddressByZipCodeCompletedEventArgs e)
       {

           if (e.Error == null)
           {
               txtAddress.Text = e.Result.Nodes[0].Value.ToString();
           }
       }

非常简单的两个小程序,代码非常的简单。

程序只用着学习使用,不用作商业应用。

原本想上传代码的,可是SkyDrive上传有问题,以后。

相关文章:

  • 2021-08-10
  • 2021-07-04
  • 2021-05-30
  • 2021-11-28
  • 2022-12-23
  • 2021-10-25
  • 2022-03-10
猜你喜欢
  • 2021-06-05
  • 2021-08-18
  • 2021-09-27
  • 2021-08-02
  • 2022-02-22
  • 2021-07-22
相关资源
相似解决方案