public async void OnNavigatedTo(INavigationParameters parameters) { var permissionStatus = await Permissions.CheckStatusAsync <Permissions.LocationWhenInUse>(); while (!PermissionGranted(permissionStatus)) { await _userDialogs.AlertAsync(new AlertConfig { Message = "Oh no!, seems like we can't access your location. To continue please give this app the corresponding access", OkText = "Ok", Title = "Permission not granted", }); await Permissions.RequestAsync <Permissions.LocationWhenInUse>(); permissionStatus = await Permissions.CheckStatusAsync <Permissions.LocationWhenInUse>(); } if (UserLocation == null) { var geolocation = await Geolocation.GetLastKnownLocationAsync(); UserLocation = new Place { Latitude = geolocation.Latitude, Longitude = geolocation.Longitude }; } if (PermissionGranted(permissionStatus)) { GetCurrentWeatherCommand.Execute(); GetForecastCommand.Execute(); } }
public void Init() { GetCurrentWeatherCommand.Execute(); }