コード例 #1
0
ファイル: Place.xaml.cs プロジェクト: mingslogar/dimension4
        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);
        }
コード例 #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);
        }
コード例 #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");
        }
コード例 #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);
        }