Пример #1
0
        private void MoveMap(Plugin.Geolocator.Abstractions.Position position)
        {
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            locarionsMap.MoveToRegion(span);
        }
Пример #2
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);

            locationsMap.MoveToRegion(span);
        }
Пример #3
0
        protected override async 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);

            /*SQLite codes
             * 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();

            DisplayInMap(posts);
        }
Пример #4
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);
        }
Пример #5
0
        // Moving the map with a position value and fixed span
        void MoveMap(Position position)
        {
            var center  = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var mapSpan = new Xamarin.Forms.Maps.MapSpan(center, 0.01, 0.01);

            locationsMap.MoveToRegion(mapSpan);
        }
Пример #6
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);
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var loc = CrossGeolocator.Current;

            loc.PositionChanged += Locator_PositionChanged;
            TimeSpan time = new TimeSpan(0, 0, 5);
            await loc.StartListeningAsync(time, 100);

            var position = await loc.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);
            }
        }
Пример #8
0
        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);
        }
Пример #9
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));
        }
Пример #10
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);
            //}
        }
Пример #11
0
        private void MoveMap(Position position)
        {
            var centure = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span    = new Xamarin.Forms.Maps.MapSpan(centure, 1, 1);

            locationsMap.MoveToRegion(span);
        }
Пример #12
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);

            locationmap.MoveToRegion(span);
        }
Пример #13
0
        /// <summary>
        /// Move to location on map based on Latitude and Longitude passed.
        /// </summary>
        /// <param name="position"></param>
        private void MoveMap(Position position)
        {
            var center  = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var mapSpan = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            MapLocations.MoveToRegion(mapSpan);
        }
Пример #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();
        }
Пример #15
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);
        }
Пример #16
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);
        }
Пример #18
0
        private void MoveMap(Position position)
        {
            //Move map to location -E63
            var center = new Xamarin.Forms.Maps.Position(position.Latitude, position.Longitude);
            var span   = new Xamarin.Forms.Maps.MapSpan(center, 1, 1);

            locationMap.MoveToRegion(span);
        }
Пример #19
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);
        }
Пример #20
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, 0.01, 0.01);

            CheckIfNewDiscovery(position);
            locationsMap.MoveToRegion(span);
        }
Пример #21
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}");
            }
        }
Пример #22
0
 public static async Task CarRequest(Xamarin.Forms.Maps.MapSpan region)
 {
     await SendNotification("Sharing Cars", $"{(await AppData.AppData.user.GetData()).Name}需要借車", $"{SendType.CarRequest}",
                            new Dictionary <string, string>
     {
         { $"{CarRequestFlag.RequestLatitude}", $"{region.Center.Latitude}" },
         { $"{CarRequestFlag.RequestLongitude}", $"{region.Center.Longitude}" },
         { $"{CarRequestFlag.RequestRadius}", $"{region.Radius.Meters}" },
         { $"{CarRequestFlag.DeviceLatitude}", $"{AppData.AppData.deviceLocation.Latitude}" },
         { $"{CarRequestFlag.DeviceLongitude}", $"{AppData.AppData.deviceLocation.Longitude}" }
     }, null);
 }
Пример #23
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);
            using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            {
                conn.CreateTable <Post>();
                var posts = conn.Table <Post>().ToList();
                DisplayInMap(posts);
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            try
            {
                var newStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Location);

                if (newStatus != status || !hasRequesterPermission)
                {
                    status = newStatus;
                    if (status != Plugin.Permissions.Abstractions.PermissionStatus.Granted)
                    {
                        if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Plugin.Permissions.Abstractions.Permission.Location))
                        {
                            await DisplayAlert("Need permission", "We will have to access your location for this", "Ok");
                        }
                        var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);

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

                    if (status == PermissionStatus.Granted)
                    {
                        locationsMap.IsShowingUser = true;
                        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);
                        locationsMap.MoveToRegion(span);

                        var posts = await Post.Read();

                        DisplayInMap(posts);
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("No permission", "You didn't grant permission for us to access your device's lcoation", "Ok");
            }
        }
Пример #25
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;

            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);

            locationMap.MoveToRegion(span);
        }
Пример #26
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");
			}

		}
Пример #27
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            var locator = CrossGeolocator.Current;

            locator.PositionChanged += Locator_PositionChanged;
            try
            {
                await locator.StartListeningAsync(new TimeSpan(20), 100);
            } catch
            {
                //nothing
            }

            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);
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            try
            {
                //Plugin.Xam.Geolocator
                var locator = CrossGeolocator.Current;
                locator.PositionChanged += Locator_PositionChanged;

                await locator.StartListeningAsync(new TimeSpan(0, 0, 0), 100);

                var position = await locator.GetPositionAsync(); //longitude and latitude

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


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

                //    DisplayInMap(posts);
                //}

                var posts = await Post.Read();

                DisplayInMap(posts);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
Пример #29
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();



            var locator = CrossGeolocator.Current;

            //locator.PositionChanged += Locator_PositionChanged;
            //await locator.StartListeningAsync((new System.TimeSpan(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);

            locationsMap.MoveToRegion(span);


            var posts = await Post.Read();

            DisplayInMap(posts);
        }
Пример #30
0
        private async 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);

            locationMaps.MoveToRegion(span);


            //using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            //{


            //    conn.CreateTable<Post>();
            //    var posts = conn.Table<Post>().ToList();

            //    DisplayMap(posts);

            //}


            var posts = await Post.Read();

            //    DisplayMap(posts);
        }