一个可靠的天气预报Web Server

一个可靠的天气预报Web   Server:

http://www.ayandy.com/

getWeatherbyCityName  
根据城市名称获得天气情况。本服务数据来源于中国气象局数据,实时更新,准确可靠。调用方法如下:输入参数:   theCityName   城市中文名称,如深圳,北京;   theDayFlag   指定是当天(1),明天(2)或后天(3),可查询未来三天的天气情况;返回数据:   String[7]   一个一维数值,共有七个元素,从[1]到[6]分别表示城市,天气,温度,风向,日期,天气图标地址。作者QQ:15244833   欢迎与朋友交流:)

支持城市同中国气象局数据。

C#代码:
using   System;
using   System.Collections.Generic;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Text;
using   System.Windows.Forms;

namespace   WindowsApplication1
{
        public   partial   class   Form1   :   Form
        {
                public   Form1()
                {
                        InitializeComponent();
                }

                private   void   Form1_Load(object   sender,   EventArgs   e)
                {
                        string[]   cs;
                        cs   =   new   com.ayandy.www.Service().getSupportProvince();
                        Int16       length;
                        length   =   Convert.ToInt16(cs[0]);

                        for   (int   i   =   1;   i   <=   length;   i++)
                                this.comboBox1.Items.Add(   cs[i]);

                }

                private   void   button1_Click(object   sender,   EventArgs   e)
                {
                        string[]   result   =   new   com.ayandy.www.Service().getWeatherbyCityName(this.comboBox2.Text,com.ayandy.www.theDayFlagEnum.Today   );

                        MessageBox.Show(result[1]   +   "/ "   +   result[2]   +   "/ "   +   result[3]);


                }

                private   void   comboBox1_SelectedIndexChanged(object   sender,   EventArgs   e)
                {
                        string[]   city;


                        Int16   length;

                        city   =   new   com.ayandy.www.Service().getSupportCity(this.comboBox1.Text);
                        length   =   Convert.ToInt16(city[0]);

                        for   (int   i   =   1;   i   <=   length;   i++)
                                this.comboBox2.Items.Add(city[i]);


                }
        }
}

原文地址:https://www.cnblogs.com/gengaixue/p/1330817.html