public static Task OpenAsync(double latitude, double longitude, MapLaunchOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } return(Current.OpenMapsAsync(latitude, longitude, options)); }
public static Task OpenAsync(Placemark placemark, MapLaunchOptions options) { if (placemark == null) { throw new ArgumentNullException(nameof(placemark)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(Current.OpenMapsAsync(placemark, options)); }
public static Task OpenAsync(Location location, MapLaunchOptions options) { if (location == null) { throw new ArgumentNullException(nameof(location)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } return(Current.OpenMapsAsync(location.Latitude, location.Longitude, options)); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options) { var uri = string.Empty; if (options.NavigationMode == NavigationMode.None) { uri = $"bingmaps:?where={placemark.GetEscapedAddress()}"; } else { uri = $"bingmaps:?rtp=~adr.{placemark.GetEscapedAddress()}{GetMode(options.NavigationMode)}"; } return(LaunchUri(new Uri(uri))); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options) { Permissions.EnsureDeclared <Permissions.LaunchApp>(); var appControl = new AppControl { Operation = AppControlOperations.Pick, Uri = "geo:", }; appControl.Uri += $"0,0?q={placemark.GetEscapedAddress()}"; AppControl.SendLaunchRequest(appControl); return(Task.CompletedTask); }
internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options) { var uri = string.Empty; if (options.NavigationMode == NavigationMode.None) { uri = $"geo:0,0?q={placemark.GetEscapedAddress()}"; if (!string.IsNullOrWhiteSpace(options.Name)) { uri += $"({AndroidUri.Encode(options.Name)})"; } } else { uri = $"google.navigation:q={placemark.GetEscapedAddress()}{GetMode(options.NavigationMode)}"; } StartIntent(uri); return(Task.CompletedTask); }
internal static async Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options) { #if __IOS__ var address = new MKPlacemarkAddress { CountryCode = placemark.CountryCode, Country = placemark.CountryName, State = placemark.AdminArea, Street = placemark.Thoroughfare, City = placemark.Locality, Zip = placemark.PostalCode }.Dictionary; #else var address = new NSMutableDictionary { [CNPostalAddressKey.City] = new NSString(placemark.Locality ?? string.Empty), [CNPostalAddressKey.Country] = new NSString(placemark.CountryName ?? string.Empty), [CNPostalAddressKey.State] = new NSString(placemark.AdminArea ?? string.Empty), [CNPostalAddressKey.Street] = new NSString(placemark.Thoroughfare ?? string.Empty), [CNPostalAddressKey.PostalCode] = new NSString(placemark.PostalCode ?? string.Empty), [CNPostalAddressKey.IsoCountryCode] = new NSString(placemark.CountryCode ?? string.Empty) }; #endif var resolvedPlacemarks = await GetPlacemarksAsync(address); if (resolvedPlacemarks?.Length > 0) { await OpenPlacemark(new MKPlacemark(resolvedPlacemarks[0].Location.Coordinate, address), options); } else { #if __IOS__ || __MACOS__ // https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html var uri = $"http://maps.apple.com/?q={placemark.GetEscapedAddress()}"; var nsurl = NSUrl.FromString(uri); await Launcher.PlatformOpenAsync(nsurl); #else await OpenPlacemark(new MKPlacemark(default, address), options);
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options) { var uri = string.Empty; var lat = latitude.ToString(CultureInfo.InvariantCulture); var lng = longitude.ToString(CultureInfo.InvariantCulture); if (options.NavigationMode == NavigationMode.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.NavigationMode)}"; } StartIntent(uri); return(Task.CompletedTask); }
public static Task OpenMapsAsync(this Location location, MapLaunchOptions options) => Map.OpenAsync(location, options);
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions 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.NavigationMode == NavigationMode.None) { uri = $"bingmaps:?collection=point.{lat}_{lng}_{name}"; } else { uri = $"bingmaps:?rtp=~pos.{lat}_{lng}_{name}{GetMode(options.NavigationMode)}"; } return(LaunchUri(new Uri(uri))); }
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options) { Permissions.EnsureDeclared <Permissions.LaunchApp>(); var appControl = new AppControl { Operation = AppControlOperations.View, Uri = "geo:", }; appControl.Uri += $"{latitude.ToString(CultureInfo.InvariantCulture)},{longitude.ToString(CultureInfo.InvariantCulture)}"; AppControl.SendLaunchRequest(appControl); return(Task.CompletedTask); }
/// <include file="../../docs/Microsoft.Maui.Essentials/PlacemarkExtensions.xml" path="//Member[@MemberName='OpenMapsAsync']/Docs" /> public static Task OpenMapsAsync(this Placemark placemark, MapLaunchOptions options) => Map.OpenAsync(placemark, options);
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions 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(Placemark placemark, MapLaunchOptions options) => throw ExceptionUtils.NotSupportedOrImplementedException;
internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options) => throw ExceptionUtils.NotSupportedOrImplementedException;