Exemple #1
0
        public void LoadForecastData(WeatherData data, string skin)
        {
            if (data == null || data.Forecast.Count <= 0) return;

              Day0IconDay = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[0].DayIcon + ".png";
              Day0IconNight = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[0].NightIcon + ".png";
              Day0Name =
            DateTime.Now.AddDays(data.Forecast[0].DayDiff)
                .ToString("dddd", CultureInfo.CurrentUICulture.DateTimeFormat)
                .ToUpperInvariant();
              Day0MaxTemp = data.GetTemp(data.Forecast[0].MaxTemp);
              Day0MinTemp = data.GetTemp(data.Forecast[0].LowTemp);
              if (data.Forecast.Count > 1)
              {
            Day1IconDay = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[1].DayIcon + ".png";
            Day1IconNight = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[1].NightIcon + ".png";
            Day1Name =
              DateTime.Now.AddDays(data.Forecast[1].DayDiff)
                  .ToString("dddd", CultureInfo.CurrentUICulture.DateTimeFormat)
                  .ToUpperInvariant();
            Day1MaxTemp = data.GetTemp(data.Forecast[1].MaxTemp);
            Day1MinTemp = data.GetTemp(data.Forecast[1].LowTemp);
              }
              if (data.Forecast.Count > 2)
              {
            Day2IconDay = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[2].DayIcon + ".png";
            Day2IconNight = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[2].NightIcon + ".png";
            Day2Name =
              DateTime.Now.AddDays(data.Forecast[2].DayDiff)
                  .ToString("dddd", CultureInfo.CurrentUICulture.DateTimeFormat)
                  .ToUpperInvariant();
            Day2MaxTemp = data.GetTemp(data.Forecast[2].MaxTemp);
            Day2MinTemp = data.GetTemp(data.Forecast[2].LowTemp);
              }
              if (data.Forecast.Count > 3)
              {
            Day3IconDay = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[3].DayIcon + ".png";
            Day3IconNight = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[3].NightIcon + ".png";
            Day3Name =
              DateTime.Now.AddDays(data.Forecast[3].DayDiff)
                  .ToString("dddd", CultureInfo.CurrentUICulture.DateTimeFormat)
                  .ToUpperInvariant();
            Day3MaxTemp = data.GetTemp(data.Forecast[3].MaxTemp);
            Day3MinTemp = data.GetTemp(data.Forecast[3].LowTemp);
              }
              if (data.Forecast.Count > 4)
              {
            Day4IconDay = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[4].DayIcon + ".png";
            Day4IconNight = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Forecast[4].NightIcon + ".png";
            Day4Name =
              DateTime.Now.AddDays(data.Forecast[4].DayDiff)
                  .ToString("dddd", CultureInfo.CurrentUICulture.DateTimeFormat)
                  .ToUpperInvariant();
            Day4MaxTemp = data.GetTemp(data.Forecast[4].MaxTemp);
            Day4MinTemp = data.GetTemp(data.Forecast[4].LowTemp);
              }
        }
Exemple #2
0
 public void LoadCurrentData(WeatherData data, string skin)
 {
     if (data == null) return;
       Location = data.LocationName;
       CurrentIcon = Helper.SkinPath + skin + @"\Weather\Icons\" + data.Today.Icon + ".png";
       CurrentBackground = Helper.SkinPath + skin + @"\Weather\Backgrounds\" + data.Today.Icon + ".jpg";
       CurrentTemp = data.GetTemp(data.Today.Temperature);
 }