コード例 #1
0
        public static async Task <WeatherQueryModel> GetWeatherInfomationAsync()
        {
            Stream            xmlstream;
            WeatherQueryModel weatherInfomation = new WeatherQueryModel();

            void getstream()
            {
                xmlstream = GetWeatherInformationFromStream(CityInformation.余姚);
                if (xmlstream != null)
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(WeatherQueryModel));
                    weatherInfomation = (WeatherQueryModel)xmlSerializer.Deserialize(xmlstream);
                }
            }

            await Task.Run(() => getstream());

            return(weatherInfomation);
        }
コード例 #2
0
 private async void BaseControl_Loaded(object sender, RoutedEventArgs e)
 {
     WeatherInformation = await WeatherInformationService.GetWeatherInfomationAsync();
 }