コード例 #1
0
        public async void OnUserRefresh()
        {
            Location currentLocation = LocationInteractor.GetCurrentLocation();

            /*
             * Is this the best way to check, or would an async getter be better?
             * Currently, bailing here achieves the same result, as the UI is updated
             * by the ILocationUpdateHandler. But I'm not quite sure if bailing
             * here is antipattern or not.
             */
            if (currentLocation == null)
            {
                return;
            }

            CurrentForecast forecast = await Interactor.GetCurrentForecast(currentLocation.Latitude, currentLocation.Longitude);

            View.RenderWeatherSummary(forecast.icon, forecast.temperature, forecast.summary);
            View.StopLoadingIndicator();
        }