Esempio n. 1
0
        private void Async_UpdateClicked()
        {
            TaskScheduler   uiScheduler = TaskScheduler.Current;
            LocationService location    = new LocationService();
            Task <Location> locTask     = location.GetCurrentLocationAsync();

            locTask.ContinueWith(_ =>
            {
                WeatherService weather  = new WeatherService();
                Task <Forecast> forTask = weather.GetForecastAsync(locTask.Result.City);
                forTask.ContinueWith(__ =>
                {
                    MessageDialog message = new MessageDialog(forTask.Result.Summary);
                    Task msgTask          = message.DisplayAsync();
                    msgTask.ContinueWith(___ =>
                    {
                        weather.Dispose();
                        location.Dispose();
                    });
                }, uiScheduler);
            });
        }