Esempio n. 1
0
        private void DownloadForecast(string location)
        {
            WebClient forecastClient = new WebClient();

            forecastClient.DownloadStringCompleted += forecastClient_DownloadStringCompleted;

            string[] loc = location.Split(',');

            forecastClient.DownloadStringAsync(new Uri("http://api.openweathermap.org/data/2.5/forecast/daily?q="
                                                       + loc[0].Trim() + "," + StateLookup.GetAbbreviation(loc[1].Trim()) + "&mode=xml&cnt=2&APPID="
                                                       + GlobalData.OpenWeatherMapAppID));
        }
Esempio n. 2
0
        private void Download()
        {
            WebClient client = new WebClient();

            client.DownloadStringCompleted += client_DownloadStringCompleted;

            string[] loc = _location.Split(',');

            client.DownloadStringAsync(new Uri("http://api.openweathermap.org/data/2.5/weather?q="
                                               + loc[0].Trim() + "," + StateLookup.GetAbbreviation(loc[1].Trim()) + "&mode=xml&APPID="
                                               + GlobalData.OpenWeatherMapAppID));
        }
Esempio n. 3
0
        private void DownloadCurrent(string location)
        {
            RaiseUpdateStatusEvent("DOWNLOADING WEATHER DATA...");

            if (currentClient != null)
            {
                currentClient.DownloadStringCompleted -= currentClient_DownloadStringCompleted;
                currentClient.CancelAsync();
            }

            currentClient = new WebClient();
            currentClient.DownloadStringCompleted += currentClient_DownloadStringCompleted;

            string[] loc = location.Split(',');

            currentClient.DownloadStringAsync(new Uri("http://api.openweathermap.org/data/2.5/weather?q="
                                                      + loc[0].Trim() + "," + StateLookup.GetAbbreviation(loc[1].Trim()) + "&mode=xml&APPID="
                                                      + GlobalData.OpenWeatherMapAppID));
        }