資源簡介
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個文件信息
評論
共有 條評論