Esempio n. 1
0
        private void currentClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            XmlDocument doc = ParseXml(e);

            if (doc == null)
            {
                return;
            }

            WeatherFunctions.WriteFileAsync(WeatherFunctions.WeatherAppData + _city + "weather.xml", e.Result);
            ShowCurrentWeather(doc);
            DownloadForecast(_city);
        }
Esempio n. 2
0
        private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            ((WebClient)sender).DownloadStringCompleted -= client_DownloadStringCompleted;

            XmlDocument doc = ParseXml(e);

            if (doc == null)
            {
                return;
            }

            WeatherFunctions.WriteFileAsync(WeatherFunctions.WeatherAppData + Location + "weather.xml", e.Result);
            UpdateValues(doc);
        }
Esempio n. 3
0
        private async void forecastClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (!await Task.Factory.StartNew <bool>(() =>
            {
                string error = null;
                XmlDocument doc = ParseXml(e, out error);

                if (doc == null)
                {
                    RaiseUpdateStatusEvent(error == null ? "ERROR PARSING FORECAST DATA" : error);
                    return(false);
                }

                WeatherFunctions.WriteFileAsync(WeatherFunctions.WeatherAppData + Location + "daily.xml", e.Result);
                ShowForecastedWeather(doc);

                return(true);
            }))
            {
                return;
            }

            RaiseUpdateStatusEvent("DOWNLOAD COMPLETE");
        }
Esempio n. 4
0
        private async void currentClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (!await Task.Factory.StartNew <bool>(() =>
            {
                string error = null;
                XmlDocument doc = ParseXml(e, out error);

                if (doc == null)
                {
                    RaiseUpdateStatusEvent(error == null ? "ERROR PARSING WEATHER DATA" : error);
                    return(false);
                }

                WeatherFunctions.WriteFileAsync(WeatherFunctions.WeatherAppData + Location + "weather.xml", e.Result);
                ShowCurrentWeather(doc);

                return(true);
            }))
            {
                return;
            }

            DownloadForecast(Location);
        }