/// <summary>
 /// Updates the image on a marker
 /// </summary>
 /// <param name="pin">The forms pin</param>
 /// <param name="marker">The native marker</param>
 private async Task UpdateImage(TKCustomMapPin pin, Marker marker)
 {
     BitmapDescriptor bitmap;
     try
     {
         if (pin.Image != null)
         {
             var icon = await new ImageLoaderSourceHandler().LoadImageAsync(pin.Image, this.Context);
             bitmap = BitmapDescriptorFactory.FromBitmap(icon);
         }
         else
         {
             if (pin.DefaultPinColor != Color.Default)
             {
                 bitmap = BitmapDescriptorFactory.DefaultMarker((float)pin.DefaultPinColor.Hue);
             }
             else
             {
                 bitmap = BitmapDescriptorFactory.DefaultMarker();
             }
         }
     }
     catch (Exception)
     {
         bitmap = BitmapDescriptorFactory.DefaultMarker();
     }
     marker.SetIcon(bitmap);
 }
예제 #2
0
 protected virtual void OnPinPropertyChanged(MapPin pin, Marker marker, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == MapPin.ColorProperty.PropertyName)
     {
         marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(pin.Color.ToAndroidMarkerHue()));
     }
     else if (e.PropertyName == MapPin.PositionProperty.PropertyName)
     {
         marker.Position = pin.Position.ToLatLng();
     }
 }
예제 #3
0
 private async void RefreshStation(Station station, Marker control)
 {
     try
     {
         station.IsUiRefreshNeeded = false;
         // this can raise a IllegalArgumentException: Released unknown imageData reference
         // as the marker may not be on the map anymore so better to check again for null ref
         control.SetIcon(_clusterRender.CreateStationIcon(station));
     }
     catch
     {
     }
 }