예제 #1
0
        public void showfive(WebRequestWeatherInfo WeatherInfo)
        {
            this.title_label.Text = WeatherInfo.result.today.city + "连续五天天气";
            this.showInfo1.show(WeatherInfo, 0);
            this.showInfo2.show(WeatherInfo, 1);
            this.showInfo3.show(WeatherInfo, 2);
            this.showInfo4.show(WeatherInfo, 3);
            this.showInfo5.show(WeatherInfo, 4);

            //图表的数据绑定
            List <string> ylowData  = new List <string>();
            List <string> yhighData = new List <string>();
            List <string> xData     = new List <string>();

            //要对温度字符串进行处理
            int tmp = 0;

            for (; tmp <= 6; tmp++)
            {
                string   s  = WeatherInfo.result.future[tmp].temperature;
                string[] ss = s.Split(new char[2] {
                    '~', '℃'
                });
                ylowData.Add(ss[0]);
                yhighData.Add(ss[2]);
                xData.Add(WeatherInfo.result.future[tmp].date);
            }

            this.date_chart.Series[0].Points.DataBindXY(xData, ylowData);
            this.date_chart.Series[1].Points.DataBindXY(xData, yhighData);
        }
예제 #2
0
        //界面显示
        public void show(WebRequestWeatherInfo WeatherInfo, int a)
        {
            this.day_label.Text  = WeatherInfo.result.future[a].date;
            this.weat_label.Text = WeatherInfo.result.future[a].weather;
            this.deg_label.Text  = WeatherInfo.result.future[a].temperature;
            this.wind_label.Text = WeatherInfo.result.future[a].wind;
            this.week_label.Text = WeatherInfo.result.future[a].week;

            //字典查询判断当前天气是否在字典内,并取出对应的图片
            if (GlobalWeatherDict.weatherpict.ContainsKey(WeatherInfo.result.future[a].weather))
            {
                int tmp = GlobalWeatherDict.weatherpict[WeatherInfo.result.future[a].weather];
                this.pictureBox.Image = weather_imageList.Images[tmp];
            }
            else
            {
                this.pictureBox.Image = weather_imageList.Images[30];
            }
        }
예제 #3
0
        //显示当天天气的函数
        public void ShowWeatherInfo(WebRequestWeatherInfo WeatherInfo)
        {
            this.city_label.Text          = "城市:" + WeatherInfo.result.today.city;
            this.tmptemp_label.Text       = "当前温度: " + WeatherInfo.result.sk.temp;
            this.date_label.Text          = WeatherInfo.result.today.date_y;
            this.time_label.Text          = WeatherInfo.result.sk.time;
            this.winddirection_label.Text = "当前风向: " + WeatherInfo.result.sk.wind_direction;
            this.windstrength_label.Text  = "当前风力: " + WeatherInfo.result.sk.wind_strength;
            this.humidity_label.Text      = "当前湿度: " + WeatherInfo.result.sk.humidity;

            this.weatherlabel.Text = "天气概况: " + WeatherInfo.result.today.weather;
            this.degree_label.Text = "温度范围: " + WeatherInfo.result.today.temperature;
            this.wind_label.Text   = "风指数: " + WeatherInfo.result.today.wind;
            this.wet_label.Text    = "湿度: " + WeatherInfo.result.sk.humidity;
            this.radio_label.Text  = "紫外线指数: " + WeatherInfo.result.today.uv_index;

            if (WeatherInfo.result.today.comfort_index.Length != 0)
            {
                this.comfort_label.Text = "舒适度指数: " + WeatherInfo.result.today.comfort_index;
            }
            else
            {
                this.comfort_label.Text = "舒适度指数: 无";
            }

            if (WeatherInfo.result.today.wash_index.Length != 0)
            {
                this.wash_label.Text = "洗车指数: " + WeatherInfo.result.today.wash_index;
            }
            else
            {
                this.comfort_label.Text = "洗车指数: 无";
            }

            if (WeatherInfo.result.today.travel_index.Length != 0)
            {
                this.travel_label.Text = "旅游指数: " + WeatherInfo.result.today.travel_index;
            }
            else
            {
                this.travel_label.Text = "旅游指数: 无";
            }

            if (WeatherInfo.result.today.exercise_index.Length != 0)
            {
                this.exercise_label.Text = "晨练指数: " + WeatherInfo.result.today.exercise_index;
            }
            else
            {
                this.exercise_label.Text = "晨练指数: 无";
            }

            if (WeatherInfo.result.today.drying_index.Length != 0)
            {
                this.dry_label.Text = "干燥指数: " + WeatherInfo.result.today.drying_index;
            }
            else
            {
                this.dry_label.Text = "干燥指数: 无";
            }

            this.tip_label.Text = "小提示:\n" + WeatherInfo.result.today.dressing_advice;

            //字典查询判断当前天气是否在字典内,并取出对应的图片
            if (GlobalWeatherDict.weatherpict.ContainsKey(WeatherInfo.result.today.weather))
            {
                int tmp = GlobalWeatherDict.weatherpict[WeatherInfo.result.today.weather];
                this.Weather_pictureBox.Image = weather_imageList.Images[tmp];
            }
            else
            {
                this.Weather_pictureBox.Image = weather_imageList.Images[30];
            }
        }