Пример #1
0
 private void MvOrgin_DidUpdateUserLocation(object sender, MapKit.MKUserLocationEventArgs e)
 {
     if (mvOrgin.UserLocation != null)
     {
         var cordinate = mvOrgin.UserLocation.Coordinate;
         var span      = new MKCoordinateSpan(0.15, 0.15);
         mvOrgin.Region = new MKCoordinateRegion(cordinate, span);
         mvOrgin.RemoveAnnotations();
         mvOrgin.AddAnnotation(new MKPointAnnotation()
         {
             Coordinate = cordinate,
             Title      = "Your Location"
         });
     }
 }
        private void DestinatinMapView_DidUpdateUserLocation(object sender, MapKit.MKUserLocationEventArgs e)
        {
            if (destinatinMapView.UserLocation != null)
            {
                var coordinates = destinatinMapView.UserLocation.Coordinate;
                var span        = new MKCoordinateSpan(0.15, 0.15);
                destinatinMapView.Region = new MKCoordinateRegion(coordinates, span);

                destinatinMapView.RemoveAnnotations();
                destinatinMapView.AddAnnotation(new MKPointAnnotation()
                {
                    Coordinate = coordinates,
                    Title      = "Точка 2"
                });
            }
        }
        private void SourceMapView_DidUpdateUserLocation(object sender, MapKit.MKUserLocationEventArgs e)
        {
            if (SourceMapView.UserLocation == null)
            {
                return;
            }

            var coordinates = SourceMapView.UserLocation.Coordinate;
            var span        = new MKCoordinateSpan(0.15, 0.15);

            SourceMapView.Region = new MKCoordinateRegion(coordinates, span);

            SourceMapView.RemoveAnnotations();
            SourceMapView.AddAnnotation(new MKPointAnnotation
            {
                Coordinate = coordinates,
                Title      = "Your location"
            });
        }
Пример #4
0
        private void OriginMapView_DidUpdateUserLocation(object sender, MapKit.MKUserLocationEventArgs e)
        {
            // throw new NotImplementedException();

            // Check whether location set to something
            if (originMapView.UserLocation != null)
            {
                var coordinates = originMapView.UserLocation.Coordinate;        // get center
                var span        = new MapKit.MKCoordinateSpan(0.15, 0.15);      // how many degrees of lat/lng to show inside the span
                originMapView.Region = new MapKit.MKCoordinateRegion(coordinates, span);

                originMapView.RemoveAnnotations();      // clear all annotations from previous operations from location/map updates
                originMapView.AddAnnotation(new MKPointAnnotation()
                {
                    Coordinate = coordinates,
                    Title      = "My own location"
                });
            }
        }