protected void Button1_Click(object sender, EventArgs e) { Log.WriteLog(DateTime.Now.ToString("HH")); WeatherForecast wi = Weather.GetForecast(TextBox1.Text); WeatherIndex ind = Weather.GetIndex(TextBox1.Text); if (!wi.CNCityName.Equals(string.Empty)) { Response.Write(string.Format("{0}市今天天气情况如下:{1}日出,白天{2},{3}摄氏度,{4}{5};<br/>{6}日落,晚上{7},{8}摄氏度,{9}{10}。--发布时间[{11}]{12}", wi.CNCityName, wi.SunriseTimeOne, WeatherForecast.GetWeatherCNByCode(wi.DayWeatherCodeOne), wi.DayTemperatureOne, WeatherForecast.GetWindDirectionCNByCode(wi.DayWindDirectionOne), WeatherForecast.GetWindForceCNByCode(wi.DayWindForceOne), wi.SunsetTimeOne, WeatherForecast.GetWeatherCNByCode(wi.NightWeatherCodeOne), wi.NightTemperatureOne, WeatherForecast.GetWindDirectionCNByCode(wi.NightWindDirectionOne), WeatherForecast.GetWindForceCNByCode(wi.NightWindForceOne), wi.PublishTime.ToString("yyyy年MM月dd日-HH:mm:ss"), "<br/>").Replace(" ", "")); Response.Write(string.Format("<img src=\"{0}\")<img/><br/>", Weather.GetForecastPic(wi.DayWeatherCodeOne))); Response.Write(string.Format("{0}市明天天气情况如下:{1}日出,白天{2},{3}摄氏度,{4}{5};<br/>{6}日落,晚上{7},{8}摄氏度,{9}{10}。--发布时间[{11}]{12}", wi.CNCityName, wi.SunriseTimeTwo, WeatherForecast.GetWeatherCNByCode(wi.DayWeatherCodeTwo), wi.DayTemperatureTwo, WeatherForecast.GetWindDirectionCNByCode(wi.DayWindDirectionTwo), WeatherForecast.GetWindForceCNByCode(wi.DayWindForceTwo), wi.SunsetTimeTwo, WeatherForecast.GetWeatherCNByCode(wi.NightWeatherCodeTwo), wi.NightTemperatureTwo, WeatherForecast.GetWindDirectionCNByCode(wi.NightWindDirectionTwo), WeatherForecast.GetWindForceCNByCode(wi.NightWindForceTwo), wi.PublishTime.ToString("yyyy年MM月dd日-HH:mm:ss"), "<br/>").Replace(" ", "")); Response.Write(string.Format("<img src=\"{0}\")<img/><br/>", Weather.GetForecastPic(wi.DayWeatherCodeTwo))); Response.Write(string.Format("{0}市后天天气情况如下:{1}日出,白天{2},{3}摄氏度,{4}{5};<br/>{6}日落,晚上{7},{8}摄氏度,{9}{10}。--发布时间[{11}]{12}", wi.CNCityName, wi.SunriseTimeThree, WeatherForecast.GetWeatherCNByCode(wi.DayWeatherCodeThree), wi.DayTemperatureThree, WeatherForecast.GetWindDirectionCNByCode(wi.DayWindDirectionThree), WeatherForecast.GetWindForceCNByCode(wi.DayWindForceThree), wi.SunsetTimeThree, WeatherForecast.GetWeatherCNByCode(wi.NightWeatherCodeThree), wi.NightTemperatureThree, WeatherForecast.GetWindDirectionCNByCode(wi.NightWindDirectionThree), WeatherForecast.GetWindForceCNByCode(wi.NightWindForceThree), wi.PublishTime.ToString("yyyy年MM月dd日-HH:mm:ss"), "<br/>").Replace(" ", "")); Response.Write(string.Format("<img src=\"{0}\")<img/><br/>", Weather.GetForecastPic(wi.DayWeatherCodeThree))); } else { Response.Write("未能获取到对应城市的天气预报信息!"); } if (!ind.clCN.Equals(string.Empty)) { Response.Write(string.Format("{0}:{1}<br/>{2}。<br/>{3}<br/>{4}:{5}<br/>{6}。{7}<br/>{8}:{9}<br/>{10}。{11}<br/>{12}", ind.clCN, ind.clCNAlias, ind.clLevel, ind.clDetails, ind.coCN, ind.coCNAlias, ind.coLevel, ind.coDetails, ind.ctCN, ind.ctCNAlias, ind.ctLevel, ind.ctDetails, "<br/>")); } else { Response.Write("未能获取到对应城市的天气指数信息!"); } }