private async static Task<bool> ShowMapWithOptionsAsyncInternal(MapOptions options) { if (options == null) { return await ShowMapAsync(); } return await LaunchMapApp(OptionsToString(options)); }
private async static Task <bool> ShowMapWithOptionsAsyncInternal(MapOptions options) { if (options == null) { return(await ShowMapAsync()); } return(await LaunchMapApp(OptionsToString(options))); }
public async void ButtonSearchRouteTapped(object sender, TappedRoutedEventArgs e) { var options = new MapOptions { ShowTraffic = true, ViewStyle = MapViewStyle.Aerial }; await MapsHelper.SearchDirectionsAsync(new MapAddress("Montreal"), new MapAddress("Ottawa"), options); }
public async void ButtonMapOptionsTapped(object sender, TappedRoutedEventArgs e) { var options = new MapOptions { ZoomLevel = new MapZoomLevel(16), ShowTraffic = true, CenterPoint = new MapPosition(43.649126, -79.377885) }; await WindowsMapsHelper.MapsHelper.ShowMapWithOptionsAsync(options); }
private async static Task<bool> SearchDirectionsAsyncInternal(IMapPoint startPoint, IMapPoint endPoint, MapOptions options) { var startPointStr = startPoint == null ? String.Empty : startPoint.ToString(); var endPointStr = endPoint == null ? String.Empty : endPoint.ToString(); var sb = new StringBuilder(); if (options != null) { sb.Append(OptionsToString(options)); } if (!String.IsNullOrWhiteSpace(startPointStr) || !String.IsNullOrWhiteSpace(endPointStr)) { sb.AppendFormat("&rtp={0}~{1}", startPointStr, endPointStr); } return await LaunchMapApp(sb.ToString()); }
private async static Task<bool> SearchAsyncInternal(string termToSearch, string whereToSearch, MapOptions options) { var sb = new StringBuilder(); if (options != null) { sb.Append(OptionsToString(options)); } if (!String.IsNullOrWhiteSpace(termToSearch)) { sb.AppendFormat("&q={0}", termToSearch); } if (!String.IsNullOrWhiteSpace(whereToSearch)) { sb.AppendFormat("&where={0}", whereToSearch); } return await LaunchMapApp(sb.ToString()); }
private static string OptionsToString(MapOptions options) { var sb = new StringBuilder(); if (options.CenterPoint != null) { sb.AppendFormat("cp={0}", options.CenterPoint.ToPointString()); } if (options.ZoomLevel != null) { sb.AppendFormat("&lvl={0:0.00}", options.ZoomLevel.ZoomLevel); } if (options.BoundingBox != null && options.BoundingBox.LowerLeftCorner != null && options.BoundingBox.UpperRightCorner != null) { sb.AppendFormat("&bb={0}_{1}~{2}_{3}", options.BoundingBox.LowerLeftCorner.Latitude, options.BoundingBox.LowerLeftCorner.Longitude, options.BoundingBox.UpperRightCorner.Latitude, options.BoundingBox.UpperRightCorner.Longitude); } if (options.ViewStyle != MapViewStyle.Default) { sb.AppendFormat("&sty={0}", options.ViewStyle == MapViewStyle.Aerial ? "a" : "r"); } if (options.ShowTraffic) { sb.Append("&trfc=1"); } return(sb.ToString().TrimStart(new[] { '&' })); }
/// <summary> /// Searches driving directions for provided points /// </summary> public static IAsyncOperation<bool> SearchDirectionsAsync(IMapPoint startPoint, IMapPoint endPoint, MapOptions options) { return AsyncInfo.Run(token => SearchDirectionsAsyncInternal(startPoint, endPoint, options)); }
/// <summary> /// Searches provided term in desired area /// </summary> public static IAsyncOperation <bool> SearchAsync(string termToSearch, string whereToSearch, MapOptions options) { return(AsyncInfo.Run(token => SearchAsyncInternal(termToSearch, whereToSearch, options))); }
/// <summary> /// Searches provided term in desired area /// </summary> public static IAsyncOperation<bool> SearchAsync(string termToSearch, string whereToSearch, MapOptions options) { return AsyncInfo.Run(token => SearchAsyncInternal(termToSearch, whereToSearch, options)); }
private static string OptionsToString(MapOptions options) { var sb = new StringBuilder(); if (options.CenterPoint != null) { sb.AppendFormat("cp={0}", options.CenterPoint.ToPointString()); } if (options.ZoomLevel != null) { sb.AppendFormat("&lvl={0:0.00}", options.ZoomLevel.ZoomLevel); } if (options.BoundingBox != null && options.BoundingBox.LowerLeftCorner!= null && options.BoundingBox.UpperRightCorner!= null) { sb.AppendFormat("&bb={0}_{1}~{2}_{3}", options.BoundingBox.LowerLeftCorner.Latitude, options.BoundingBox.LowerLeftCorner.Longitude, options.BoundingBox.UpperRightCorner.Latitude, options.BoundingBox.UpperRightCorner.Longitude); } if (options.ViewStyle != MapViewStyle.Default) { sb.AppendFormat("&sty={0}", options.ViewStyle == MapViewStyle.Aerial ? "a" : "r"); } if (options.ShowTraffic) { sb.Append("&trfc=1"); } return sb.ToString().TrimStart(new[]{'&'}); }
/// <summary> /// Shows map configured according to the provided options /// </summary> public static IAsyncOperation<bool> ShowMapWithOptionsAsync(MapOptions options) { return AsyncInfo.Run(token => ShowMapWithOptionsAsyncInternal(options)); }
public void ShowMap() { // TODO: Show a pin or something with current air quality measurements? (nice to have, seems not possible right now) var options = new MapOptions() { CenterPoint = new MapPosition(SelectedMeasurement.Location.Latitude, SelectedMeasurement.Location.Longitude) }; MapsHelper.ShowMapWithOptionsAsync(options); }
/// <summary> /// Shows map configured according to the provided options /// </summary> public static IAsyncOperation <bool> ShowMapWithOptionsAsync(MapOptions options) { return(AsyncInfo.Run(token => ShowMapWithOptionsAsyncInternal(options))); }
private async static Task <bool> SearchAsyncInternal(string termToSearch, string whereToSearch, MapOptions options) { var sb = new StringBuilder(); if (options != null) { sb.Append(OptionsToString(options)); } if (!String.IsNullOrWhiteSpace(termToSearch)) { sb.AppendFormat("&q={0}", termToSearch); } if (!String.IsNullOrWhiteSpace(whereToSearch)) { sb.AppendFormat("&where={0}", whereToSearch); } return(await LaunchMapApp(sb.ToString())); }
private async static Task <bool> SearchDirectionsAsyncInternal(IMapPoint startPoint, IMapPoint endPoint, MapOptions options) { var startPointStr = startPoint == null ? String.Empty : startPoint.ToString(); var endPointStr = endPoint == null ? String.Empty : endPoint.ToString(); var sb = new StringBuilder(); if (options != null) { sb.Append(OptionsToString(options)); } if (!String.IsNullOrWhiteSpace(startPointStr) || !String.IsNullOrWhiteSpace(endPointStr)) { sb.AppendFormat("&rtp={0}~{1}", startPointStr, endPointStr); } return(await LaunchMapApp(sb.ToString())); }
/// <summary> /// Searches driving directions for provided points /// </summary> public static IAsyncOperation <bool> SearchDirectionsAsync(IMapPoint startPoint, IMapPoint endPoint, MapOptions options) { return(AsyncInfo.Run(token => SearchDirectionsAsyncInternal(startPoint, endPoint, options))); }