Пример #1
0
        /// <summary>
        /// Gets from web service Country and City list
        /// </summary>
        /// <returns>temporaryWeatherFile.XmlDoc</returns>
        public XmlDocument GetCountryAndCityData()
        {
            WeatherServiceClient.net.webservicex.www.GlobalWeather client = new WeatherServiceClient.net.webservicex.www.GlobalWeather();
            DateTime nowTime = DateTime.Now;

            //Load file from disk if not empty or last update not so long ago xxx (xxx ticks ago)
            if (temporaryWeatherFile.Length() > 0 &&
                (nowTime.Ticks - temporaryWeatherFile.TimeTemporaryFile.Ticks) < 600000000000      // 1 minute
                )
            {
                if (!temporaryWeatherFile.InMemory)
                {
                    temporaryWeatherFile.LoadFromDisk();
                }
            }
            else
            {
                // Gets from service all Country and City
                temporaryWeatherFile.LoadXml(client.GetCitiesByCountry(""));
            }

            return(temporaryWeatherFile.XmlDoc);
        }
        /// <summary>
        /// Gets from web service Country and City list
        /// </summary>
        /// <returns>temporaryWeatherFile.XmlDoc</returns>
        public XmlDocument GetCountryAndCityData()
        {
            WeatherServiceClient.net.webservicex.www.GlobalWeather client = new WeatherServiceClient.net.webservicex.www.GlobalWeather();
            DateTime nowTime = DateTime.Now;

            //Load file from disk if not empty or last update not so long ago xxx (xxx ticks ago)
            if (temporaryWeatherFile.Length() > 0 &&
                     (nowTime.Ticks - temporaryWeatherFile.TimeTemporaryFile.Ticks) < 600000000000 // 1 minute
                )
            {
                if(!temporaryWeatherFile.InMemory)
                {
                    temporaryWeatherFile.LoadFromDisk();
                }

            }
            else
            {
                // Gets from service all Country and City
                temporaryWeatherFile.LoadXml(client.GetCitiesByCountry(""));
            }

            return temporaryWeatherFile.XmlDoc;
        }