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); }
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); }
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"); }
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); }