static Task OpenPlacemark(MKPlacemark placemark, MapsLaunchOptions options) { var mapItem = new MKMapItem(placemark) { Name = options.Name ?? string.Empty }; var mode = MKDirectionsMode.Default; switch (options.MapDirectionsMode) { case MapDirectionsMode.Driving: mode = MKDirectionsMode.Driving; break; case MapDirectionsMode.Transit: mode = MKDirectionsMode.Transit; break; case MapDirectionsMode.Walking: mode = MKDirectionsMode.Walking; break; } var launchOptions = new MKLaunchOptions { DirectionsMode = mode }; var mapItems = new[] { mapItem }; MKMapItem.OpenMaps(mapItems, launchOptions); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) { placemark = placemark.Escape(); var uri = string.Empty; if (options.MapDirectionsMode == MapDirectionsMode.None) { uri = $"bingmaps:?where=" + $"{placemark.Thoroughfare}" + $"%20{placemark.Locality}" + $"%20{placemark.AdminArea}" + $"%20{placemark.PostalCode}" + $"%20{placemark.CountryName}"; } else { uri = $"bingmaps:?rtp=~adr." + $"{placemark.Thoroughfare}" + $"%20{placemark.Locality}" + $"%20{placemark.AdminArea}" + $"%20{placemark.PostalCode}" + $"%20{placemark.CountryName}" + $"{GetMode(options.MapDirectionsMode)}"; } return(LaunchUri(new Uri(uri))); }
internal static async Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) { var address = new MKPlacemarkAddress { CountryCode = placemark.CountryCode, Country = placemark.CountryName, State = placemark.AdminArea, Street = placemark.Thoroughfare, City = placemark.Locality, Zip = placemark.PostalCode }; var coder = new CLGeocoder(); CLPlacemark[] placemarks = null; try { placemarks = await coder.GeocodeAddressAsync(address.Dictionary); } catch { Debug.WriteLine("Unable to get geocode address from address"); return; } if ((placemarks?.Length ?? 0) == 0) { Debug.WriteLine("No locations exist, please check address."); } await OpenPlacemark(new MKPlacemark(placemarks[0].Location.Coordinate, address), options); }
public static Task OpenAsync(double latitude, double longitude, MapsLaunchOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } return(PlatformOpenMapsAsync(latitude, longitude, options)); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) { placemark = placemark.Escape(); var uri = $"geo:0,0?q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.CountryName}"; if (!string.IsNullOrWhiteSpace(options.Name)) { uri += $"({options.Name})"; } StartIntent(uri); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) { placemark = placemark.Escape(); var uri = new Uri( $"bingmaps:?where=" + $"{placemark.Thoroughfare}" + $"%20{placemark.Locality}" + $"%20{placemark.AdminArea}" + $"%20{placemark.CountryName}"); return(LaunchUri(uri)); }
public static Task OpenAsync(Location location, MapsLaunchOptions options) { if (location == null) { throw new ArgumentNullException(nameof(location)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(PlatformOpenMapsAsync(location.Latitude, location.Longitude, options)); }
public static Task OpenAsync(Placemark placemark, MapsLaunchOptions options) { if (placemark == null) { throw new ArgumentNullException(nameof(placemark)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(PlatformOpenMapsAsync(placemark, options)); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) { placemark = placemark.Escape(); var uri = string.Empty; if (options.MapDirectionsMode == MapDirectionsMode.None) { uri = $"geo:0,0?q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.PostalCode} {placemark.CountryName}"; if (!string.IsNullOrWhiteSpace(options.Name)) { uri += $"({AndroidUri.Encode(options.Name)})"; } } else { uri = $"google.navigation:q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.PostalCode} {placemark.CountryName}{GetMode(options.MapDirectionsMode)}"; } StartIntent(uri); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) { if (string.IsNullOrWhiteSpace(options.Name)) { options.Name = string.Empty; } NSDictionary dictionary = null; var placemark = new MKPlacemark(new CLLocationCoordinate2D(latitude, longitude), dictionary); return(OpenPlacemark(placemark, options)); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) { var uri = string.Empty; var lat = latitude.ToString(CultureInfo.InvariantCulture); var lng = longitude.ToString(CultureInfo.InvariantCulture); if (options.MapDirectionsMode == MapDirectionsMode.None) { uri = $"geo:{lat},{lng}?q={lat},{lng}"; if (!string.IsNullOrWhiteSpace(options.Name)) { uri += $"({AndroidUri.Encode(options.Name)})"; } } else { uri = $"google.navigation:q={lat},{lng}{GetMode(options.MapDirectionsMode)}"; } StartIntent(uri); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) { var lat = latitude.ToString(CultureInfo.InvariantCulture); var lng = longitude.ToString(CultureInfo.InvariantCulture); var name = options.Name ?? string.Empty; var uri = string.Empty; if (options.MapDirectionsMode == MapDirectionsMode.None) { uri = $"bingmaps:?collection=point.{lat}_{lng}_{name}"; } else { uri = $"bingmaps:?rtp=~pos.{lat}_{lng}_{name}{GetMode(options.MapDirectionsMode)}"; } return(LaunchUri(new Uri(uri))); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) { var uri = string.Empty; uri = $"geo:{latitude.ToString(CultureInfo.InvariantCulture)},{longitude.ToString(CultureInfo.InvariantCulture)}?q={latitude.ToString(CultureInfo.InvariantCulture)},{longitude.ToString(CultureInfo.InvariantCulture)}"; if (!string.IsNullOrWhiteSpace(options.Name)) { uri += $"({options.Name})"; } StartIntent(uri); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) { return(LaunchUri(new Uri( $"bingmaps:?collection=point." + $"{latitude.ToString(CultureInfo.InvariantCulture)}" + $"_" + $"{longitude.ToString(CultureInfo.InvariantCulture)}" + $"_" + $"{options.Name ?? string.Empty}"))); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options) => throw new NotImplementedInReferenceAssemblyException();
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options) => throw new NotImplementedInReferenceAssemblyException();
public static Task OpenMapsAsync(this Placemark placemark, MapsLaunchOptions options) => Maps.OpenAsync(placemark, options);
public static Task OpenMapsAsync(this Location location, MapsLaunchOptions options) => Maps.OpenAsync(location, options);