private async void LoadData() { try { var _position = await GeolocationManager.GetPosition(); //var _position = GeolocationManager.position; _weatherVM.Latitude = (float)_position.Coordinate.Latitude; _weatherVM.Longitude = (float)_position.Coordinate.Longitude; _weatherVM.WeatherData = await WeatherData.GetCurrentWeather( _weatherVM.Latitude, _weatherVM.Latitude); RootObject CurrentWeather = _weatherVM.WeatherData; if (CurrentWeather.cod == 404) { var dialog = new MessageDialog("Unable to get weather at this time"); await dialog.ShowAsync(); } else { DisplayWeather(CurrentWeather); } } catch (Exception) { LocationTB.Text = "Unable to get weather at this time."; } }
protected async override void OnAppearing() { GeolocationManager = new GeolocationManager(this); if (GeolocationManager.IsGpsEnabledAsync().Result) { InitUserLocation(); } else { await PopupNavigation.Instance.PushAsync(new MessageBox("Your Gps position could not be extracted, please turn on your gps and please ensure you have internet before you try again", MessageType.Gps, this, this)); } }
private async void InitUserLocation() { try { location = await GeolocationManager.GetLocationAsync(); Init(); } catch (Exception ex) { Log.Warning("GPS EXCEPTION", ex.Message); } }
protected async void InitUserLocation() { try { location = await GeolocationManager.GetLocationAsync(); if (location != null) { InitUserCoordinates(); } } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new MessageBox(ex.StackTrace, MessageType.Regular, this), true); } }
public MapManager(LiveDataManager liveDataManager, SymbolsManager symbolsManager, Config config, IEventAggregator eventAggregator, IPageDialogService dialogService, GeolocationManager geolocationManager) { _vehiculesLayer = new GraphicsOverlay { MinScale = config.Map.VehiculesLayerMinScale }; _liveDataManager = liveDataManager; _liveDataManager.DataUpdateAvailable += OnDataUpdateAvailable; _liveDataManager.VehiculeLimitExceeded += OnVehiculeLimitExceeded; _liveDataManager.DataTimeout += OnDataTimeout; _symbolsManager = symbolsManager; _symbolsCache = new Dictionary <string, PictureMarkerSymbol>(); _config = config; _eventAggregator = eventAggregator; _dialogService = dialogService; _geolocationManager = geolocationManager; Lignes = new LigneSens[0]; }
protected async override void OnAppearing() { try { GeolocationManager = new GeolocationManager(this); var enabled = await GeolocationManager.IsGpsEnabledAsync(); if (enabled) { InitUserLocation(); } else { await PopupNavigation.Instance.PushAsync(new MessageBox("Your Gps position could not be extracted, please turn on your gps and please ensure you have internet before you try again", MessageType.Gps, this, this)); } } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new MessageBox(ex.StackTrace, MessageType.Regular, this, this)); } }
public async void SetCoordinate(GeolocationManager manager) { Latitude = manager.Latitude; Longitude = manager.Longitude; _isSetCoordinate = true; }
public GeoServices(Xamarin.Essentials.Location location) { _geolocationManager = new GeolocationManager(); _location = location; }
public App() { InitializeComponent(); GeolocationManager = new GeolocationManager(); MainPage = new NavigationPage(new MapApp.Views.MainPage()); }