コード例 #1
0
ファイル: WeatherForm.cs プロジェクト: mishagl/weather
        private void renderWeather(Weather weather)
        {
            timer1.Stop();

            if (weather == null)
            {
                picWeather.ImageLocation = "";
                notifyIconWeather.BalloonTipText = notifyIconWeather.Text = lblPressure.Text = lblHumidity.Text = lblDescription.Text = lblTemperature.Text = "n/a";
            }
            else
            {
                picWeather.ImageLocation = weather.ImgSource;
                lblDescription.Text = weather.Title;
                lblTemperature.Text = weather.GetTemperature();
                lblHumidity.Text = weather.GetHumidity();
                lblPressure.Text = weather.GetPressure();

                foreach (var x in forecast.Zip(weather.Forecasts.OrderBy(f => f.Date), (a, b) => new { Control = a, Forecast = b }))
                {
                    var c = x.Control;
                    var f = x.Forecast;

                    c.Day = f.Date;
                    c.TemperatureHigh = f.GetHighTemp();
                    c.TemperatureLow = f.GetLowTemp();
                    c.Condition = f.Condition.GetDescription();
                }

                renderTrayWeather(weather, currentLocation);
            }

            timer1.Interval = (int)TimeSpan.FromMinutes(10).TotalMilliseconds;
            timer1.Start();
        }
コード例 #2
0
ファイル: weather.cs プロジェクト: pronebel/wp8
        //构造函数
        public dataSource()
        {
            weather = new Weather();

        }
コード例 #3
0
ファイル: WeatherForm.cs プロジェクト: mishagl/weather
        private void renderTrayWeather(Weather weather, GeoLocation currentLocation)
        {
            notifyIconWeather.Text = weather.GetTemperature() + " - " + currentLocation.Name;
            notifyIconWeather.BalloonTipText = weather.ToString();
            notifyIconWeather.BalloonTipTitle = "Weather";

            notifyIconWeather.Icon = renderIcon(weather.Temperature);
        }