コード例 #1
0
 void AddStoreAnnotations(List <GroceryStore> stores)
 {
     foreach (var store in stores)
     {
         var storeAnnotation = new StoreAnnotation(store);
         //make sure we dont already have the annotation
         bool alreadyContainsAnnotation = false;
         foreach (var annotation in map.Annotations)
         {
             StoreAnnotation mapAnnotationAsStore = annotation as StoreAnnotation;
             if (mapAnnotationAsStore != null)
             {
                 if (mapAnnotationAsStore.Address == store.Address)
                 {
                     alreadyContainsAnnotation = true;
                     break;
                 }
             }
         }
         if (!alreadyContainsAnnotation)
         {
             map.AddAnnotation(storeAnnotation);
         }
     }
 }
コード例 #2
0
        void AddStoreAnnotations()
        {
            var stores = StoreFactory.GetStores();

            foreach (var store in stores)
            {
                var annotation = new StoreAnnotation(store);
                map.AddAnnotation(annotation);
            }
        }
コード例 #3
0
        public override void DidSelectAnnotationView(MKMapView mapView, MKAnnotationView view)
        {
            StoreAnnotation storeAnnotation = view.Annotation as StoreAnnotation;

            if (storeAnnotation != null)
            {
                var coord = storeAnnotation.Coordinate;

                var destination = new MKMapItem(new MKPlacemark(coord, (MKPlacemarkAddress)null));
                ShowDirections(destination, mapView);
            }
        }