Example #1
0
        public void CreateSeekiosMarkerAsync(string seekiosId
                                             , string title
                                             , string imageBase64
                                             , DateTime?lastLocationDate
                                             , double latitude
                                             , double longitude
                                             , double accuracy
                                             , bool isDontMove = false
                                             , bool isInAlert  = false)
        {
            var seekiosLocation = new CLLocationCoordinate2D(latitude, longitude);
            var seekiosImg      = CreateSeekiosBitmap(imageBase64, accuracy, isInAlert, isDontMove);

            var seekiosAnnotation = new SeekiosAnnotation(seekiosLocation, seekiosImg);

            seekiosAnnotation.IdSeekios = int.Parse(seekiosId);
            MapViewControl.AddAnnotations(seekiosAnnotation);
            SelectedAnnotation = seekiosAnnotation;
            CreateAccuracyArea(latitude, longitude, accuracy);
            seekiosAnnotation.IsAlert = isInAlert;

            _annotations.Add(seekiosAnnotation);
            _annotationIdAssociation.Add(new SeekiosMarkerIdAssociation(seekiosId, seekiosAnnotation.Id));

            if (App.Locator.ModeZone.IsOnEditMode && App.Locator.ModeZone.IsActivityFocused)
            {
            }
            else
            {
                MapViewControl.SelectAnnotation(seekiosAnnotation, true);
            }
        }
Example #2
0
        private void SelectAnnotation()
        {
            MapViewControl.RemoveAnnotations(MapViewControl.Annotations);

            if (ViewModel.Annotation != null &&
                ViewModel.Annotation.Addresses != null &&
                ViewModel.Annotation.Addresses.Length > 0)
            {
                var annotations = ViewModel.Annotation.Addresses
                                  .Select(address => new MapViewAnnotation(
                                              ViewModel.Annotation.Pin,
                                              ViewModel.Annotation.Title,
                                              address)).ToArray();
                var coordinates = MapUtil.GetAnnotationsCoordinates(annotations);

                MapViewControl.SetRegion(
                    MapUtil.CoordinateRegionForCoordinates(
                        coordinates,
                        new MKMapSize(5000, 5000)),
                    false);
                MapViewControl.AddAnnotations(annotations);
                MapViewControl.SelectAnnotation(annotations[0], false);
            }
        }