惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

博客园 - 阳光追梦

Xamarin Android ListView 控件使用 Xamarin Android -创建Splash Screen (一) Web Api 2 接口API文档美化 高仿Windows Phone QQ登录界面 Windows Phone 8 显示当前项目的使用内存,最大峰值,最大内存上限 Windows Phone 8 下载文件进度 Windows Phone 8 开发资料 jquery 选择器大全 转载:SQL 递归树 子父节点相互查询 Silverlight 代水印的查询文本框 Style Create a Settings Page for Windows phone Android 4.1 新增UI模板 Winwdos Phone 从手机中读取相册图片 windows phone 7 学习笔记 五 TileSample windows phone 学习笔记 四 Windows Phone 7 学习笔记三------文本框输入作用域 2011 西安世界园艺博览会-----Silverlight 电子地图上线 Linq 读取简单的XML数据 Esri for Window Phone 7(一) 加载BingMap
Windows Phone 7 学习笔记------常用工具(二)
阳光追梦 · 2011-04-26 · via 博客园 - 阳光追梦

上一篇文章中不知道是怎么一会事,图片上在上传时失真了,这次把上一次的重新修改后与大家分享。

在本篇文章中也将介绍自己写的两个非常简单的小工具。

小工具一、QQ在线查询

我想大家对于QQ的了解,就不用多说了,可以查询到QQ隐身的好友,在线的好友就不用说了。在QQ本身是没有这个功能的,所以写这个实用的

功能与大家。

运行结果如下:

image                                                               image

代码:

private QQ.qqOnlineWebServiceSoapClient client = null;
        public QQuery()
        {
            InitializeComponent();
            client = new QQ.qqOnlineWebServiceSoapClient();
            InitServer();
            Loaded += (a, b) =>
            {
                txtQQ.Text = "399858803";
            };
        }

        private void InitServer()
        {
            client.qqCheckOnlineCompleted += (a, re) =>
            {
                if (re.Error == null)
                {
                    txtQQResult.Text = string.Format("当前QQ号:{0}\r\n{1}", txtQQ.Text, re.Result == "Y" ? "处于在线状态" : "处理离线状态");
                }
            };
        }

        private void btnQuery_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtQQ.Text))
            {
                client.qqCheckOnlineAsync(txtQQ.Text);
            }
        }

说明:代码是相当简单的,就是利用第三方提供的webServer服务。调用服务就可以就查询,并返回结果值。

小工具二、列车时刻查询

运行结果如下:

image                                                            image

运行代码:

private Train.TrainTimeWebServiceSoapClient clinet = null;
        public TrainQuery()
        {
            InitializeComponent();
            clinet = new Train.TrainTimeWebServiceSoapClient();
            InitServer();
            //txtTrain.Text = "2334";
        }

        private void InitServer()
        {
            clinet.getDetailInfoByTrainCodeCompleted += (a, re) =>
            {

                if (re.Error == null)
                {
                    txtResult.Text = re.Result.Nodes[0].Value;
                }
            };
        }

        private void btnQuery_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // TODO: Add event handler implementation here.
            if (!string.IsNullOrEmpty(txtTrain.Text))
            {
                clinet.getDetailInfoByTrainCodeAsync(txtTrain.Text, "");
            }
            else
                clinet.getDetailInfoByTrainCodeAsync("", "");
        }

小工具三、IP地址查询工具

运行结果如下:

image                                                                      image

运行代码如下:

private IP.IpAddressSearchWebServiceSoapClient client = null;
        public IPQuery()
        {
            InitializeComponent();
            client = new IP.IpAddressSearchWebServiceSoapClient();
            InitServer();
        }

        private void InitServer()
        {
            client.getCountryCityByIpCompleted += (a, Re) =>
            {
                if (Re.Error == null)
                {
                    txtResult.Text = string.Format("当前IP{0}为:{1}", txtIPaddress.Text, Re.Result[1].ToString());
                }
            };
        }

        private void btnQuery_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // TODO: Add event handler implementation here.
            if (!string.IsNullOrEmpty(txtIPaddress.Text))
            {
                client.getCountryCityByIpAsync(txtIPaddress.Text);
            }
        }

小工具四、邮政编码查询工具

运行结果如下:

image                                                                      image

运行代码如下:

private Zip.ChinaZipSearchWebServiceSoapClient client = null;
       public PostCodeQuery()
       {
           InitializeComponent();
           client = new Zip.ChinaZipSearchWebServiceSoapClient();
           InitServer();
       }

       private void InitServer()
       {
           client.getAddressByZipCodeCompleted += (a, re) =>
           {
               if (re.Error == null)
               {
                   txtResult.Text = re.Result.Nodes[0].Value;
               }
           };
       }

       private void btnQuery_Click(object sender, System.Windows.RoutedEventArgs e)
       {
           // TODO: Add event handler implementation here.
           if (!string.IsNullOrEmpty(txtPostCode.Text))
           {
               client.getAddressByZipCodeAsync(txtPostCode.Text, "");
           }
       }
 
上面的程序代码都很简间,只要用到了WP7 的Piovt进行左右进行滑动。功能简单但在生活中很实用。其中全都是用到了第三方提供的webserver服务。每一个服务中都提供了很多的方面,供我们使用。关于服务中的方法与使用请参见http://www.webxml.com.cn/zh_cn/web_services.aspxp 这里提供了更加详细的说明。
 
在项目中还有几个没有实现的小工具,有兴趣的朋友可以下载源码,进行完善。在小工具中,没有进行页面的美化,以实现为原则,如果你的美术功底深厚,这就是你展示你才华的地方。
 
本程序是学习过程中的学习笔记,在程序中难免有不足的地方希望大家正一起交流学习。
源代码:http://cid-904fa9b9fc4c059f.office.live.com/self.aspx/Windows%20Phone%207/WP7Demo.zip