Ejemplo n.º 1
0
        private void GetOpenWeaterDetailsOffline(string city)
        {
            appId = ConfigurationManager.AppSettings["OpenWeather"];
            OpenWeather _weather = new OpenWeather(appId, SelectedCity.Name);

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\\Debug\\", "Offline Datas\\"), string.Format("{0}\\{1}.txt", SelectedWeatherSource, city));
            if (!File.Exists(path))
                throw new Exception(string.Format("Please download the data for {0} to work in offline mode.", city));

            OpenWeatherDetails weatherDetails = _weather.GetOpenWeatherDetailsOffline(File.ReadAllText(path));
            _weatherDetails = weatherDetails;
            LoadOpenWeatherDates(weatherDetails);
        }