private void DisplayInMap(List <Post> posts)
        {
            try
            {
                foreach (var post in posts)
                {
                    var position = new Xamarin.Forms.Maps.Position(post.Latitude, post.Longitude);
                    var pin      = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = post.VenueName,
                        Address  = post.Address
                    };

                    locationsMap.Pins.Add(pin);
                }
            }
            catch (NullReferenceException nre)
            {
                // throw new Exception(nre.InnerException.ToString());
            }
            catch (Exception ex)
            {
                // throw new Exception(ex.InnerException.ToString());
            }
        }
示例#2
0
        private async void DisplayInMap()
        {
            var posts = await Post.Read();

            foreach (var post in posts)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(post.Lat, post.Lng);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = post.Venuename,
                        Address  = post.Address,
                    };
                    LocationMap.Pins.Add(pin);
                }



                catch (NullReferenceException nre)
                { }

                catch (Exception ex)
                { }
            }
        }
示例#3
0
        private void Locator_PositionChanged(object sender, Plugin.Geolocator.Abstractions.PositionEventArgs e)
        {
            var center = new Xamarin.Forms.Maps.Position(e.Position.Latitude, e.Position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationMap.MoveToRegion(span);
        }
示例#4
0
        private void DisplayInMap(List <Advertisement> advertisements)
        {
            foreach (var adv in advertisements)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(adv.latitude, adv.longitude);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = adv.description,
                        Address  = adv.distance.ToString() + " m"
                    };

                    locationMap.Pins.Add(pin);
                }
                catch (NullReferenceException ex)
                {
                }
                catch (Exception ex)
                {
                }
            }
        }
示例#5
0
        public void Movemap(Position position)
        {
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            Locationxml.MoveToRegion(span);
        }
示例#6
0
        private void DisplayInMap(List <Post> posts)
        {
            foreach (var post in posts)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(post.Latitude, post.Longitude);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = post.VenueName,
                        Address  = post.Address
                    };

                    locationsMap.Pins.Add(pin);
                }
                catch (NullReferenceException nre)
                {
                    DisplayAlert("Error", nre.Message, "OK");
                }
                catch (Exception ex)
                {
                    DisplayAlert("Error", ex.Message, "OK");
                }
            }
        }
示例#7
0
 private void Geoposition_PositionChange(object sender, Position e)
 {
     if (e.Success)
     {
         if (_finishposition)
         {
             _finishposition = false;
             if (!_search)
             {
                 GridMap.Children.Clear();
                 var position = new Xamarin.Forms.Maps.Position(e.Latitude, e.Longitude);
                 var map      = new Xamarin.Forms.Maps.Map(Xamarin.Forms.Maps.MapSpan.FromCenterAndRadius(position, Xamarin.Forms.Maps.Distance.FromMiles(0.7)))
                 {
                     IsShowingUser   = true,
                     VerticalOptions = LayoutOptions.FillAndExpand
                 };
                 map.Pins.Clear();
                 var pin = Pin(position, "Tu posición actual");
                 map.Pins.Add(pin);
                 GridMap.Children.Add(map);
                 _finishposition = false;
             }
             else
             {
                 _finishposition = true;
             }
         }
     }
 }
示例#8
0
        private void MoveMap(Position position)
        {
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            locationsMap.MoveToRegion(span);
        }
示例#9
0
        private async void Locator_PositionChanged(object sender, Plugin.Geolocator.Abstractions.PositionEventArgs e)
        {
            var center = new Xamarin.Forms.Maps.Position(e.Position.Latitude, e.Position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationsMap.MoveToRegion(span);


            var posts = await Post.Read();

            DisplayInMap(posts);

            //Azure Function

            //Old Code
            //var posts = await App.MobileService.GetTable<Post>().Where(post => post.userId == App.currentUser.Id).ToListAsync();
            //DisplayInMap(posts);

            //SQL Function Here
            //using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            //{
            //    conn.CreateTable<Post>();
            //    var posts = conn.Table<Post>().ToList();
            //    DisplayInMap(posts);
            //}
        }
示例#10
0
        private async void DisplayInMap(List <ExclusivePost> posts)
        {
            try
            {
                foreach (var post in posts)
                {
                    string[] latlong  = post.gCord.Split(' ');
                    var      position = new Xamarin.Forms.Maps.Position(double.Parse(latlong[0].Trim()), double.Parse(latlong[1].Trim()));

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = post.Title,
                        Address  = post.GroupName
                    };

                    locationsMap.Pins.Add(pin);
                }
            }
            catch (NullReferenceException nre)
            {
                await DisplayAlert("Information", nre.Message, "OK");
            }
            catch (Exception ex)
            {
                await DisplayAlert("Information", ex.Message, "OK");
            }
        }
示例#11
0
        private async void DisplayInMap()
        {
            var subscription = await FirestoreHelper.ReadSubscription();

            foreach (var item in subscription)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(item.Lat, item.Lng);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        Label    = item.VenueName,
                        Address  = item.Address
                    };
                    locationmaps.Pins.Add(pin);
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Message", ex.Message, "Okay");
                }
            }
        }
示例#12
0
        async void ObtenerDireccion(double lat, double lon)
        {
            try
            {
                var position          = new Xamarin.Forms.Maps.Position(lat, lon);
                var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(position);

                foreach (var address in possibleAddresses)
                {
                    try
                    {
                        string[] auxDireccion = address.Split(Convert.ToChar("\n"));
                        Direccion = auxDireccion[0];
                        break;
                    }
                    catch
                    {
                        Direccion = "Ups, no te localizamos";
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;
            await locator.StartListeningAsync(TimeSpan.Zero, 100);

            var position = await locator.GetPositionAsync();

            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationsMap.MoveToRegion(span);

            /* this is local data base
             * using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
             * {
             *  conn.CreateTable<Post>();
             *  var posts = conn.Table<Post>().ToList();
             *
             *  DisplayInMap(posts);
             * } */
            //get from azure cloud data base
            var posts = await Post.Read();

            DisplayInMap(posts);
        }
示例#14
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            if (hasLocationPermissions)
            {
                var locator = CrossGeolocator.Current;
                locator.PositionChanged += Locator_PositionChanged;
                await locator.StartListeningAsync(TimeSpan.Zero, 100);

                var position = await locator.GetPositionAsync();

                var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
                var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);
                locationsMap.MoveToRegion(span);

                using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
                {
                    conn.CreateTable <Post>();                //Nothing if it is already created
                    var posts = conn.Table <Post>().ToList(); //return table query object

                    DisplayInMap(posts);
                };
            }

            //GetLocation();
        }
        private void DisplayInMap(List <Post> posts)
        {
            foreach (var post in posts)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(post.Latitude, post.Longitude);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SearchResult,
                        Position = position,
                        Label    = post.VenueName,
                        Address  = post.Address
                    };


                    locationsMap.Pins.Add(pin);
                }
                catch (NullReferenceException nre)
                {
                    Console.WriteLine(nre);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception " + ex);
                }
            }
        }
示例#16
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;
            await locator.StartListeningAsync(TimeSpan.FromSeconds(0), 100);

            var position = await locator.GetPositionAsync();

            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationMaps.MoveToRegion(span);

            /*using (SQLiteConnection conn = new SQLiteConnection(App.DataBaseLocation))
             * {
             *      conn.CreateTable<Post>();
             *      var posts = conn.Table<Post>().ToList();
             *
             *      DisplayInMap(posts);
             * }*/

            //var posts =await Post.Read();
            var posts = await Post.GetPostByUserId(App.user.Id);

            DisplayInMap(posts);
        }
示例#17
0
        private void DisplayInMap(List <Post> posts)
        {
            foreach (var post in posts)
            {
                try
                {
                    var position = new Xamarin.Forms.Maps.Position(post.Latitude, post.Longitude);

                    var pin = new Xamarin.Forms.Maps.Pin()
                    {
                        Type     = Xamarin.Forms.Maps.PinType.SavedPin,
                        Position = position,
                        //Label=post.VenueName,
                        //Address=post.Address
                    };
                    locationMaps.Pins.Add(pin);
                }
                catch (NullReferenceException nre)
                {
                }
                catch (Exception ex)
                {
                }
            }
        }
示例#18
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;
            await locator.StartListeningAsync(TimeSpan.FromSeconds(0), 100);

            var position = await locator.GetPositionAsync();

            //locationsMap.MoveToRegion(new Xamarin.Forms.Maps.MapSpan(new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude), 2, 2));

            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationsMap.MoveToRegion(span);

            //using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            //{
            //    conn.CreateTable<Post>();
            //    var posts = conn.Table<Post>().ToList();

            //    DisplayInMap(posts);
            //}

            //var posts = await App.MobileService.GetTable<Post>().Where(p => p.UserId == App.user.id).ToListAsync();

            var posts = await Post.Read();

            DisplayInMap(posts);
        }
示例#19
0
        /// <summary>
        /// to make the app more responsive to the user
        /// from nuget, load the xamarin forms goelocator plugin.
        /// uses the overidden "OnAppearing()" method to repaint the map
        /// when it changes location
        /// </summary>

        protected async override void OnAppearing()
        {
            //Onappearing reloads everytime the page is accessed
            //since one of the statements is awaitable the method
            //should be async

            //uses the base class to intiialise the object
            base.OnAppearing();

            //using the geolocator plugin class to assign a geolocator obj
            var myLocater = CrossGeolocator.Current;

            //event handler for the location change event
            myLocater.PositionChanged += MyLocater_PositionChanged;

            //assigns a timespan variable
            TimeSpan intervaltime = new TimeSpan(0, 0, 0);

            //listens for a change of location sets the time
            //interval for the "positionchanged" event to be fired
            //and the minimum distance of 100m, awaitable task.
            await myLocater.StartListeningAsync(intervaltime, 100);

            //assign the geolocation value to a variable
            var position = await myLocater.GetPositionAsync();

            //moves to the region map place define by the location
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            LocationsMaps.MoveToRegion(span);
        }
示例#20
0
        /// <summary>
        /// Convert Xamarin.Forms.Maps.MapSpan to Mapsui.Geometries.BoundingBox
        /// </summary>
        /// <param name="rect">Rectangle in Xamarin.Forms.Maps.MapSpan </param>
        /// <returns>BoundingBox format</returns>
        public static Mapsui.Geometries.BoundingBox ToMapsui(this Xamarin.Forms.Maps.MapSpan rect)
        {
            // Found at https://forums.xamarin.com/discussion/22493/maps-visibleregion-bounds

            var center            = rect.Center;
            var halfheightDegrees = rect.LatitudeDegrees / 2;
            var halfwidthDegrees  = rect.LongitudeDegrees / 2;

            var left   = center.Longitude - halfwidthDegrees;
            var right  = center.Longitude + halfwidthDegrees;
            var top    = center.Latitude + halfheightDegrees;
            var bottom = center.Latitude - halfheightDegrees;

            // Adjust for Internation Date Line (+/- 180 degrees longitude)
            if (left < -180)
            {
                left = 180 + (180 + left);
            }
            if (right > 180)
            {
                right = (right - 180) - 180;
            }
            // I don't wrap around north or south; I don't think the map control allows this anyway

            var bottomLeft = new Xamarin.Forms.Maps.Position(bottom, left).ToMapsui();
            var topRight   = new Xamarin.Forms.Maps.Position(top, right).ToMapsui();

            return(new Geometries.BoundingBox(bottomLeft, topRight));
        }
示例#21
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;
            TimeSpan ts = TimeSpan.FromSeconds(0);
            await locator.StartListeningAsync(ts, 100);

            var position = await locator.GetPositionAsync();

            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);

            locationsMaps.MoveToRegion(span);

            using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            {
                conn.CreateTable <Post>();
                var posts = conn.Table <Post>().ToList();

                DisplayInMap(posts);
            }
        }
示例#22
0
        public MapPage()
        {
            InitializeComponent();
            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                DisplayAlert("Отсутствует подключение к сети", null, null, "OK");
                return;
            }
            for (int i = 0; i < MyListPage.events.Count; i++)
            {
                if (ContentManager.ActualEvents[i].HasCoords)
                {
                    Xamarin.Forms.Maps.Pin mapPin = new Xamarin.Forms.Maps.Pin
                    {
                        Type     = Xamarin.Forms.Maps.PinType.Place,
                        Position = new Xamarin.Forms.Maps.Position(ContentManager.ActualEvents[i].Lat, ContentManager.ActualEvents[i].Lon),
                        Label    = ContentManager.ActualEvents[i].Title,
                        Address  = ContentManager.ActualEvents[i].Address
                    };
                    MyMap.Pins.Add(mapPin);
                    positions.Add(ContentManager.ActualEvents[i]);
                    mapPin.InfoWindowClicked += async(s, args) =>
                    {
                        foreach (var item in ContentManager.ActualEvents)
                        {
                            if (item.Title.Equals(((Xamarin.Forms.Maps.Pin)s).Label))
                            {
                                try
                                {
                                    await Navigation.PushModalAsync(new Detail(item));
                                }
                                catch (Java.Lang.RuntimeException)
                                {
                                    await DisplayAlert("Ошибка выгрузки события", null, null, "OK");

                                    ContentManager.ActualEvents.Remove(item);
                                }
                            }
                        }
                    };
                }
            }
            var myPos = new Xamarin.Forms.Maps.Pin
            {
                Type     = Xamarin.Forms.Maps.PinType.SearchResult,
                Position = new Xamarin.Forms.Maps.Position(MyLat, MyLon),
                Label    = "Me",
                Address  = ""
            };

            MyMap.Pins.Add(myPos);
            Xamarin.Forms.GoogleMaps.Position posit = new Xamarin.Forms.GoogleMaps.Position(MyLat, MyLon);
            CameraPosition cameraPosition           = new CameraPosition(posit, 18, 155, 65);
            CameraUpdate   cameraUpdate             = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            Xamarin.Forms.Maps.Position post = new Xamarin.Forms.Maps.Position(MyLat + 1, MyLon + 1);
            Xamarin.Forms.Maps.MapSpan  sp   = new Xamarin.Forms.Maps.MapSpan(post, MyLat, MyLon);
            MyMap.MoveToRegion(sp);
        }
        private void MoveMap(Position position)
        {
            //Code to move to the map to current location
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1); // 1,1 gives the area around center (examples 1/2 degree to left and 1/2 degree to right).

            locationsMaps.MoveToRegion(span);
        }
示例#24
0
        void Locator_PositionChanged(object sender, Plugin.Geolocator.Abstractions.PositionEventArgs e)
        {
            var center  = new Xamarin.Forms.Maps.Position(e.Position.Latitude, e.Position.Longitude);
            var current = locationsMap.VisibleRegion;
            var span    = new Xamarin.Forms.Maps.MapSpan(center, current.LatitudeDegrees, current.LongitudeDegrees);

            locationsMap.MoveToRegion(span);
        }
示例#25
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            // IsShowingUser="******" set after getting permission
            Debug.WriteLine("OnAppearing is called!!!!!!!!!!!!");
            try
            {
                var newStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);

                if (newStatus != status || !hasRequestedPermission)//Add these checks to avoid onAppearing loop
                {
                    status = newStatus;

                    if (status != PermissionStatus.Granted)
                    {
                        if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
                        {
                            await DisplayAlert("Need permission", "We will have to access your location", "Ok");
                        }
                        //This triggers the onAppearing again when permission denied without condition checks
                        var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);

                        hasRequestedPermission = true;
                        status = results[Permission.Location];
                    }
                }

                if (status == PermissionStatus.Granted)
                {
                    locationsMap.IsShowingUser = true;

                    var locator = CrossGeolocator.Current;
                    locator.PositionChanged += Locator_PositionChanged;

                    await locator.StartListeningAsync(TimeSpan.Zero, 100);

                    var position = await locator.GetPositionAsync();

                    var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
                    var span   = new Xamarin.Forms.Maps.MapSpan(center, 2, 2);
                    locationsMap.MoveToRegion(span);

                    var posts = await Post.Read();

                    DisplayInMap(posts);
                }
                else
                {
                    //When MapPage is appeared first time, this is called twice(onAppearing called twice) but then swiping to MapPage triggers this only once
                    await DisplayAlert("No permission", "You didn't grant permission to access your location, we cannot proceed.", "Ok");
                }
            }
            catch (Exception e)
            {
                //await DisplayAlert("No permission", "You didn't grant permission to access your location, we cannot proceed.", "Ok");
                Debug.WriteLine($"Exception: {e.Message}");
            }
        }
示例#26
0
 private Xamarin.Forms.Maps.Pin Pin(Xamarin.Forms.Maps.Position position, string text = "")
 {
     _pin = new Xamarin.Forms.Maps.Pin
     {
         Position = position,
         Type     = Xamarin.Forms.Maps.PinType.Generic,
         Label    = text
     };
     return(_pin);
 }
示例#27
0
 private async void btGoogleMaps_Clicked(object sender, EventArgs e)
 {
     try
     {
         Xamarin.Forms.Maps.Position pos = new Xamarin.Forms.Maps.Position(savedPosition.Latitude, savedPosition.Longitude);
         await Navigation.PushAsync(new GoogleMapsPage(pos));
     }
     catch (Exception ex)
     {
     }
 }
示例#28
0
        async void ObtenerDireccion(double lat, double lon)
        {
            var position          = new Xamarin.Forms.Maps.Position(lat, lon);
            var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(position);

            foreach (var address in possibleAddresses)
            {
                Direccion = address;
                break;
            }
        }
示例#29
0
 CustomPin GetCustomPin(IMKAnnotation annotation)
 {
     try
     {
         var position = new Xamarin.Forms.Maps.Position(annotation.Coordinate.Latitude, annotation.Coordinate.Longitude);
         return(formsMap?.ItemsSource?.FirstOrDefault(pin => pin.Pin.Position == position));
     }
     catch (Exception)
     {
         return(null);
     }
 }
示例#30
0
 public ParkingCreateViewModel(Position position)
 {
     DataService = new DataService();
     _iconNameBasedOnCategory = "ic_location_black";
     Coordenate = position;
     GetParkingCategoriesAsync();
     GetParkingTypesAsync();
     ParkingPhoto       = "add_photo";
     _navigationService = NavigationService.GetInstance();
     MessagingCenter.Subscribe <EventModel>(this, Messages.ParkingEventCreated,
                                            parkingEvent => { ParkingEvent = parkingEvent; });
 }
示例#31
0
 private async void GetPosition()
 {
     try
     {
         var position = await _geolocator.GetPositionAsync(10000);
         UserPosition = position == null
             ? new Position(0, 0)
             : new Position(position.Latitude, position.Longitude);
         _geolocator.PositionChanged +=
         (sender, args) => UserPosition = new Position(args.Position.Latitude, args.Position.Longitude);
         _geolocator.StartListening(10000, 5);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.ToString());
     }
 }
示例#32
0
		/// <summary>
		/// Handles the <see cref="E:PositionChanged" /> event.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="PositionEventArgs"/> instance containing the event data.</param>
		private void OnPositionChanged(object sender, PositionEventArgs e)
		{
			try {
				object position = new { 
					Latitude = e.Position.Latitude, 
					Longitude = e.Position.Longitude, 
					Timestamp = e.Position.Timestamp,
					Accuracy = e.Position.Accuracy,
					Speed = e.Position.Speed,
					Altitude = e.Position.Altitude
				};
				JObject jsonObject = JObject.FromObject(position);

				//TuGrua.App.io.Emit ("SetPositionCrane", jsonObject);

			} catch (Exception ex) {
				Console.WriteLine (ex.Message);
			}

			try {
				Xamarin.Forms.Maps.Position pos = new Xamarin.Forms.Maps.Position(e.Position.Latitude, e.Position.Longitude);
				var mapSpan = new Xamarin.Forms.Maps.MapSpan (pos, 0.01, 0.01);
				TuGrua.RequestService.ThisPage._map.MoveToRegion (mapSpan);
                TuGrua.RequestService.ThisPage.MyPosition = e.Position;
                TuGrua.RequestService.ThisPage.CanRequest = true;
                TuGrua.RequestService.ThisPage._requestServiceButton.IsEnabled = true;
			} 
			catch (Exception ex) {
				Console.WriteLine (ex.Message);
                //TuGrua.RequestService.ThisPage.CanRequest = false;
            }

			try {
				TuGrua.RequestService.ThisPage._listenStatus.Text = "Estado:" + e.Position.Timestamp.ToString("G");
				TuGrua.RequestService.ThisPage._listenLatitude.Text = "Latitud: " + e.Position.Latitude.ToString("N4");
				TuGrua.RequestService.ThisPage._listenLongitude.Text = "Longitud: " + e.Position.Longitude.ToString("N4");
			} catch (Exception) {
				Console.WriteLine ("Error with visual elements: RequestService.cs");
			}

		}