• 大小: 132KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-02-01
  • 语言: C#
  • 标签: 天气预报  C#  

资源简介

C#编写天气预报,采用了中国气象台的一手数据,完全自己编写,利用了一个公司里的IP数据库来进行判断所在地,用户可以根据所在地不同而获得该地的实时天气预报!

资源截图

代码片段和文件信息

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public partial class _Default : System.Web.UI.Page 
{
    //protected string myTempString = “湖北省武汉市“;
    protected void Page_Load(object sender EventArgs e)
    {
        GetCityByIP.IpAddressSearchWebService myCityByIP = new GetCityByIP.IpAddressSearchWebService();   //通过IP获得城市信息
        string myTempString = myCityByIP.getCountryCityByIp(Request.UserHostAddress.ToString())[1];
        string myCityTemp = myTempString.Substring(myTempString.IndexOf(“省“) myTempString.IndexOf(“市“));
        string myCity = myCityTemp.Substring(1 (myCityTemp.Length - 3));


        GetWeatherByCity.WeatherWebService myWeatherByCity = new GetWeatherByCity.WeatherWebService();  //通过城市获得该城市的天气情况
        string[] myWeatherInfo = myWeatherByCity.getWeatherbyCityName(myCity);
        Label1.Text = myWeatherInfo[0] +“/“+ myWeatherInfo[1];
        Label2.Text = myWeatherInfo[6] + “   “ + myWeatherInfo[5] + “   “ + myWeatherInfo[7];
        Image1.ImageUrl = “~/images/weather/“ + myWeatherInfo[8];
        Image2.ImageUrl = “~/images/weather/“ + myWeatherInfo[9];





        //string a = “中华人民共和国“;
        //string b = a.Substring(a.IndexOf(“华“) a.IndexOf(“共“));
        //Response.Write(b.ToString());
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        855  2008-12-24 15:00  WeatherGet\App_WebReferences\GetCityByIP\IpAddressSearchWebService.disco

     文件        668  2008-12-24 15:00  WeatherGet\App_WebReferences\GetCityByIP\IpAddressSearchWebService.discomap

     文件      16913  2008-12-24 15:00  WeatherGet\App_WebReferences\GetCityByIP\IpAddressSearchWebService.wsdl

     文件        807  2008-12-24 15:02  WeatherGet\App_WebReferences\GetWeatherByCity\WeatherWebService.disco

     文件        636  2008-12-24 15:02  WeatherGet\App_WebReferences\GetWeatherByCity\WeatherWebService.discomap

     文件      31597  2008-12-24 15:02  WeatherGet\App_WebReferences\GetWeatherByCity\WeatherWebService.wsdl

     文件        742  2008-12-24 16:54  WeatherGet\Default.aspx

     文件       1593  2008-12-24 16:54  WeatherGet\Default.aspx.cs

     文件         43  2004-10-15 00:03  WeatherGet\images\spacer.gif

     文件        460  2007-03-23 13:23  WeatherGet\images\weather\0.gif

     文件        458  2007-03-23 13:23  WeatherGet\images\weather\1.gif

     文件        404  2007-03-23 23:49  WeatherGet\images\weather\10.gif

     文件        453  2007-03-23 23:49  WeatherGet\images\weather\11.gif

     文件        460  2007-03-23 23:50  WeatherGet\images\weather\12.gif

     文件        450  2007-03-23 23:50  WeatherGet\images\weather\13.gif

     文件        440  2007-03-23 18:30  WeatherGet\images\weather\14.gif

     文件        436  2007-03-23 18:30  WeatherGet\images\weather\15.gif

     文件        453  2007-03-23 13:23  WeatherGet\images\weather\16.gif

     文件        458  2007-03-23 23:50  WeatherGet\images\weather\17.gif

     文件        366  2007-03-23 18:30  WeatherGet\images\weather\18.gif

     文件        438  2007-03-23 23:50  WeatherGet\images\weather\19.gif

     文件        420  2007-03-23 13:23  WeatherGet\images\weather\2.gif

     文件        451  2007-03-23 23:51  WeatherGet\images\weather\20.gif

     文件        434  2007-03-23 23:51  WeatherGet\images\weather\21.gif

     文件        441  2007-03-23 23:51  WeatherGet\images\weather\22.gif

     文件        459  2007-03-23 23:51  WeatherGet\images\weather\23.gif

     文件        450  2007-03-23 23:51  WeatherGet\images\weather\24.gif

     文件        467  2007-03-23 23:51  WeatherGet\images\weather\25.gif

     文件        429  2007-03-23 23:51  WeatherGet\images\weather\26.gif

     文件        442  2007-03-23 23:51  WeatherGet\images\weather\27.gif

............此处省略97个文件信息

评论

共有 条评论