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(); }
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); }