Exemplo n.º 1
0
        //protected override void OnDisappearing()
        //{
        //    if (cts != null && !cts.IsCancellationRequested)
        //        cts.Cancel();
        //    base.OnDisappearing();
        //}

        public async Task NavigateTo(string lat, string lon)
        {
            try
            {
                var latitude   = double.Parse(lat, System.Globalization.CultureInfo.InvariantCulture);
                var longtitude = double.Parse(lon, System.Globalization.CultureInfo.InvariantCulture);

                var location = new Xamarin.Essentials.Location(latitude, longtitude);
                var options  = new MapLaunchOptions {
                    NavigationMode = NavigationMode.Walking
                };

                DependencyService.Get <IMessage>().ShortAlert("Opening navigation");
                await Map.OpenAsync(location, options);
            }
            catch (Exception e)
            {
                DependencyService.Get <IMessage>().LongAlert(e.Message);
            }
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     Xamarin.Essentials.Location location = (Location)value;
     return(new Position(location.Latitude, location.Longitude));
 }