コード例 #1
0
        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.";
            }
        }
コード例 #2
0
 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));
     }
 }
コード例 #3
0
ファイル: Dashboard.xaml.cs プロジェクト: lulzzz/DCAnalytics
        private async void InitUserLocation()
        {
            try
            {
                location = await GeolocationManager.GetLocationAsync();

                Init();
            }
            catch (Exception ex)
            {
                Log.Warning("GPS EXCEPTION", ex.Message);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 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];
 }
コード例 #6
0
ファイル: Dashboard.xaml.cs プロジェクト: lulzzz/DCAnalytics
        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));
            }
        }
コード例 #7
0
ファイル: AddPinViewModel.cs プロジェクト: a1exv/Map_Xamarin
 public async void SetCoordinate(GeolocationManager manager)
 {
     Latitude         = manager.Latitude;
     Longitude        = manager.Longitude;
     _isSetCoordinate = true;
 }
コード例 #8
0
 public GeoServices(Xamarin.Essentials.Location location)
 {
     _geolocationManager = new GeolocationManager();
     _location           = location;
 }
コード例 #9
0
ファイル: App.xaml.cs プロジェクト: a1exv/Map_Xamarin
 public App()
 {
     InitializeComponent();
     GeolocationManager = new GeolocationManager();
     MainPage           = new NavigationPage(new MapApp.Views.MainPage());
 }