public ForecastViewModel()
        {
            if (DesignerProperties.IsInDesignTool)
            {
                CurrentForecastData = new ForecastData
                {
                    Temperature = "20",
                    Rain = "0",
                    CI = "舒適",
                    WeatherIcon = "Weather02.bmp",
                    Wx = "短暫雨"
                };

                WeatherIcon = "Weather02.bmp";
                MaxT = "28";
                MinT = "17";
            }
        }
        public void UpdateFromXml()
        {
            if (mForecastCity == null || mForecastTown == null)
                return;

            mForecastData = GetLatestForecastFromXML();
            if (mForecastData != null)
                UpdateTile(mForecastCity.Name + mForecastTown.Name);
        }
        public void Get72HrForecastFromXML()
        {
            StreamReader streamReader = Utils.readXML(Utils.GetXmlFileName(Navigation.ForecastCity, XML_72HR_POSTFIX));

            if (streamReader == null)
            {
                return;
            }

            XDocument loadedData = XDocument.Load(streamReader);
            streamReader.Close();
            streamReader.Dispose();

            var timeData12hr = from c1 in loadedData.Descendants("Time")
                               where c1.Attribute("slice").Value == "12"
                               from c2 in c1.Descendants("FcstTime")
                               select (string)c2;

            var timeData3hr = from c1 in loadedData.Descendants("Time")
                              where c1.Attribute("slice").Value == "3"
                              from c2 in c1.Descendants("FcstTime")
                              select (string)c2;

            var forecastData12hr = from c1 in loadedData.Descendants("Area")
                                   where c1.Attribute("AreaID").Value == Navigation.ForecastCity.ID
                                   from c2 in c1.Descendants("Value")
                                   where c2.Attribute("layout").Value == "12"
                                   select new ForecastData
                                   {
                                       Temperature = (string)c2.Element("Temperature"),
                                       Wx = (string)c2.Element("Wx"),
                                       WeatherDes = (string)c2.Element("WeatherDes"),
                                       WeatherIcon = (string)c2.Element("WeatherIcon"),
                                       RH = (string)c2.Element("RH"),
                                       Rain = (string)c2.Element("PoP"),
                                       WindSpeed = (string)c2.Element("WindSpeed"),
                                       WindDir = (string)c2.Element("WindDir"),
                                       MinCI = (string)c2.Element("MinCI"),
                                       MaxCI = (string)c2.Element("MaxCI"),
                                       MinT = (string)c2.Element("MinT"),
                                       MaxT = (string)c2.Element("MaxT"),
                                       WindLevel = (string)c2.Element("WindLevel")
                                   };
            IList<ForecastData> forecast12hrDataList = forecastData12hr.ToList();

            for (int i = 0; i < forecast12hrDataList.Count; i++)
            {
                forecast12hrDataList[i].Time = timeData12hr.ElementAt(i);
            }

            var forecastData3hr = from c1 in loadedData.Descendants("Area")
                                  where c1.Attribute("AreaID").Value == Navigation.ForecastCity.ID
                                  from c2 in c1.Descendants("Value")
                                  where c2.Attribute("layout").Value == "3"
                                  select new ForecastData
                                  {
                                      Temperature = (string)c2.Element("Temperature"),
                                      Wx = (string)c2.Element("Wx"),
                                      WeatherDes = (string)c2.Element("WeatherDes"),
                                      WeatherIcon = (string)c2.Element("WeatherIcon"),
                                      RH = (string)c2.Element("RH"),
                                      Rain = (string)c2.Element("PoP"),
                                      WindSpeed = (string)c2.Element("WindSpeed"),
                                      WindDir = (string)c2.Element("WindDir"),
                                      CI = (string)c2.Element("CI"),
                                      MinCI = (string)c2.Element("MinCI"),
                                      MaxCI = (string)c2.Element("MaxCI"),
                                      MinT = (string)c2.Element("MinT"),
                                      MaxT = (string)c2.Element("MaxT"),
                                      WindLevel = (string)c2.Element("WindLevel")
                                  };
            IList<ForecastData> forecast3hrDataList = forecastData3hr.ToList();

            for (int i = 0; i < forecast3hrDataList.Count; i++)
            {
                forecast3hrDataList[i].Time = timeData3hr.ElementAt(i);
            }

            m72hrForecastData = null;
            ForecastData currentData3hr = null;
            ForecastData currentData12hr = null;

            foreach (ForecastData data in forecast3hrDataList)
            {
                if (Convert.ToDateTime(data.Time).CompareTo(DateTime.Now) > 0)
                {
                    currentData3hr = data;
                    break;
                }
            }

            foreach (ForecastData data in forecast12hrDataList)
            {
                if (Convert.ToDateTime(data.Time).CompareTo(DateTime.Now) > 0)
                {
                    currentData12hr = data;
                    break;
                }
            }

            if (currentData3hr != null && currentData12hr != null)
            {
                m72hrForecastData = new ForecastData
                {
                    Temperature = currentData3hr.Temperature,
                    Wx = currentData3hr.Wx,
                    WeatherDes = currentData3hr.WeatherDes,
                    WeatherIcon = currentData3hr.WeatherIcon,
                    RH = currentData3hr.RH,
                    Rain = currentData12hr.Rain,
                    WindSpeed = currentData3hr.WindSpeed,
                    WindDir = currentData3hr.WindDir,
                    CI = currentData3hr.CI,
                    MinCI = currentData12hr.MinCI,
                    MaxCI = currentData12hr.MaxCI,
                    MinT = currentData12hr.MinT,
                    MaxT = currentData12hr.MaxT,
                    Time = currentData12hr.Time
                };
            }
        }