/// <summary> /// Navigate to specific latitude and longitude. /// </summary> /// <param name="name">Label to display</param> /// <param name="latitude">Lat</param> /// <param name="longitude">Long</param> /// <param name="navigationType">Type of navigation</param> public async void NavigateTo(string name, double latitude, double longitude, NavigationType navigationType = NavigationType.Default) { if (string.IsNullOrWhiteSpace(name)) { name = string.Empty; } // Get the values required to specify the destination. var driveOrWalk = navigationType == NavigationType.Walking ? "ms-walk-to" : "ms-drive-to"; // Assemble the Uri to launch. var uri = new Uri(driveOrWalk + ":?destination.latitude=" + latitude.ToString(CultureInfo.InvariantCulture) + "&destination.longitude=" + longitude.ToString(CultureInfo.InvariantCulture) + "&destination.name=" + name); // Launch the Uri. var success = await Windows.System.Launcher.LaunchUriAsync(uri); if (success) { return; } var mapsDirectionsTask = new MapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. var location = new GeoCoordinate(latitude, longitude); var lml = new LabeledMapLocation(name, location); mapsDirectionsTask.End = lml; mapsDirectionsTask.Show(); }
private void directionTask_Click(object sender, EventArgs e) { LabeledMapLocation start = null; LabeledMapLocation end = null; if (!string.IsNullOrEmpty(departureTerm.Text)) { start = new LabeledMapLocation { Label = departureTerm.Text } } ; if (!string.IsNullOrEmpty(destinationTerm.Text)) { end = new LabeledMapLocation { Label = destinationTerm.Text } } ; if (start == null && end == null) { MessageBox.Show("Please enter start and/or end locations."); return; } var task = new MapsDirectionsTask { Start = start, End = end }; task.Show(); } } }
/// <summary> /// Navigate to specific latitude and longitude. /// </summary> /// <param name="name">Label to display</param> /// <param name="latitude">Lat</param> /// <param name="longitude">Long</param> /// <param name="navigationType">Type of navigation</param> public async void NavigateTo(string name, double latitude, double longitude, NavigationType navigationType = NavigationType.Default) { if (string.IsNullOrWhiteSpace(name)) name = string.Empty; // Get the values required to specify the destination. var driveOrWalk = navigationType == NavigationType.Walking ? "ms-walk-to" : "ms-drive-to"; // Assemble the Uri to launch. var uri = new Uri(driveOrWalk + ":?destination.latitude=" + latitude.ToString(CultureInfo.InvariantCulture) + "&destination.longitude=" + longitude.ToString(CultureInfo.InvariantCulture) + "&destination.name=" + name); // Launch the Uri. var success = await Windows.System.Launcher.LaunchUriAsync(uri); if (success) { return; } var mapsDirectionsTask = new MapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. var location = new GeoCoordinate(latitude, longitude); var lml = new LabeledMapLocation(name, location); mapsDirectionsTask.End = lml; mapsDirectionsTask.Show(); }
private void btnMapsDirectionsTask_Click_1(object sender, RoutedEventArgs e) { MapsDirectionsTask mapDirectionsTask = new MapsDirectionsTask(); mapDirectionsTask.Start = new LabeledMapLocation("Sevilla", new GeoCoordinate(37.387908, 6.001959)); mapDirectionsTask.End = new LabeledMapLocation("Madrid", new GeoCoordinate(40.420299, 3.705770)); mapDirectionsTask.Show(); }
void GotoLocation(double lat, double lng, String name) { MapsDirectionsTask mdt = new MapsDirectionsTask(); GeoCoordinate gpsLocation = new GeoCoordinate(lat, lng); LabeledMapLocation mapLocation = new LabeledMapLocation(name, gpsLocation); mdt.End = mapLocation; mdt.Show(); }
private void btnMap_Click(object sender, RoutedEventArgs e) { MapsDirectionsTask mdt = new MapsDirectionsTask() { Start = new LabeledMapLocation("Ho Chi Minh, Viet Nam", null), End = new LabeledMapLocation("Ha Noi, Viet Nam", null) }; mdt.Show(); }
public void LaunchNavigationAsync(NavigationModel navigationModel) { var mapsDirectionsTask = new MapsDirectionsTask(); var destinationGeolocation = new GeoCoordinate(navigationModel.Latitude, navigationModel.Longitude); var destinationMapLocation = new LabeledMapLocation(navigationModel.DestinationName, destinationGeolocation); mapsDirectionsTask.End = destinationMapLocation; mapsDirectionsTask.Show(); }
private void buttonGetdirection_Click(object sender, EventArgs e) { Microsoft.Phone.Tasks.MapsDirectionsTask mdt = new MapsDirectionsTask(); LabeledMapLocation LMLD = new LabeledMapLocation(); LMLD.Label = "Rumah Zakat"; LMLD.Location = new System.Device.Location.GeoCoordinate(-6.943214, 107.630858); mdt.End = LMLD; mdt.Show(); }
/// <summary> /// Navigate to an address /// </summary> /// <param name="name">Label to display</param> /// <param name="street">Street</param> /// <param name="city">City</param> /// <param name="state">Sate</param> /// <param name="zip">Zip</param> /// <param name="country">Country</param> /// <param name="countryCode">Country Code if applicable</param> /// <param name="navigationType">Navigation type</param> public Task <bool> NavigateTo(string name, string street, string city, string state, string zip, string country, string countryCode, NavigationType navigationType = NavigationType.Default) { try { if (string.IsNullOrWhiteSpace(name)) { name = string.Empty; } if (string.IsNullOrWhiteSpace(street)) { street = string.Empty; } if (string.IsNullOrWhiteSpace(city)) { city = string.Empty; } if (string.IsNullOrWhiteSpace(state)) { state = string.Empty; } if (string.IsNullOrWhiteSpace(zip)) { zip = string.Empty; } if (string.IsNullOrWhiteSpace(country)) { country = string.Empty; } var mapsDirectionsTask = new MapsDirectionsTask(); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. var lml = new LabeledMapLocation(string.Format("{0}%20{1},%20{2}%20{3}%20{4}", street, city, state, zip, country), null); mapsDirectionsTask.End = lml; // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point. mapsDirectionsTask.Show(); } catch (Exception ex) { Debug.WriteLine("Unable to launch maps: " + ex); return(Task.FromResult(false)); } return(Task.FromResult(true)); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (sender == Rutte) { MapsDirectionsTask mapsDirectionsTask = new MapsDirectionsTask(); mapsDirectionsTask.Start = new LabeledMapLocation(OriginTitle.Text, OriginMarker.GeoCoordinate); mapsDirectionsTask.End = new LabeledMapLocation(DestinationTitle.Text, DestinationMarker.GeoCoordinate); mapsDirectionsTask.Show(); } }
private void Navigation_Click(object sender, System.EventArgs e) { // Get Directions var mapsDirectionsTask = new MapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. var loc = new GeoCoordinate(_currentItem.Coordinate.Latitude, _currentItem.Coordinate.Longitude); var itemLoc = new LabeledMapLocation(_currentItem.Name, loc); // If mapsDirectionsTask.Start is not set, the user's current location mapsDirectionsTask.End = itemLoc; mapsDirectionsTask.Show(); }
private void map_direction_task(object sender, RoutedEventArgs e) { MapsDirectionsTask MapsDirectionsTask = new MapsDirectionsTask(); //MapsDirectionTask'ın Start methoduna karşılık bir değer vermediğinizde başlangıç noktası olarak telefonun mevcut konumunu kullanabilirsiniz. //GeoCoordinate besiktas_koordinat = new GeoCoordinate(41.042646, 29.007299); //MapsDirectionsTask.End = new LabeledMapLocation("Istanbul Beşiktaş", besiktas_koordinat); MapsDirectionsTask.Start = new LabeledMapLocation("Istanbul Mecidiyeköy", null); MapsDirectionsTask.End = new LabeledMapLocation("Istanbul Taksim", null); MapsDirectionsTask.Show(); }
private void Route_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MapsDirectionsTask direction = new MapsDirectionsTask(); LabeledMapLocation startLabeled = new LabeledMapLocation("Ваше местоположение", App.ResultPageViewModel.UserGeoCoordinate); direction.Start = startLabeled; LabeledMapLocation endLabeled = new LabeledMapLocation(App.ResultPageViewModel.SelectPlace.Name, new GeoCoordinate(App.ResultPageViewModel.SelectPlace.Geometry.Location.Lat, App.ResultPageViewModel.SelectPlace.Geometry.Location.Lng)); direction.End = endLabeled; direction.Show(); }
private void Route_Click(object sender, EventArgs e) { MapsDirectionsTask direction = new MapsDirectionsTask(); LabeledMapLocation startLabeled = new LabeledMapLocation("Ваше местоположение", App.PlaceInfoViewModel.UserLocation); direction.Start = startLabeled; LabeledMapLocation endLabeled = new LabeledMapLocation(App.PlaceInfoViewModel.PlaceInfo.Name, App.PlaceInfoViewModel.PlaceLocation); direction.End = endLabeled; direction.Show(); }
private async void btnDirection_Click(object sender, RoutedEventArgs e) { //NavigationService.Navigate(new Uri("/View/Exhibiton/Direction.xaml?start=" + senderAddress.Text+"&end="+receiveAddress.Text, UriKind.Relative)); MapsDirectionsTask mapsDic = new MapsDirectionsTask(); LabeledMapLocation start = new LabeledMapLocation(); start.Label = senderAddress.Text; LabeledMapLocation end = new LabeledMapLocation(); end.Label = receiveAddress.Text; mapsDic.Start = start; // điểm bắt đầu mapsDic.End = end; // điểm kết thúc mapsDic.Show(); }
private void RouteToCar() { if (IsolatedStorageSettings.ApplicationSettings.Contains("car")) { Car car = (Car)IsolatedStorageSettings.ApplicationSettings["car"]; MapsDirectionsTask mapsDirectionsTask = new MapsDirectionsTask(); LabeledMapLocation carMapLocation = new LabeledMapLocation("Ma voiture", car.Geo); mapsDirectionsTask.End = carMapLocation; mapsDirectionsTask.Show(); } else { this.OnUiThread(() => { MessageBox.Show("Vous devez d'abord sauvegarder la position de votre voiture."); }); } }
/// <summary> /// Navigate to an address /// </summary> /// <param name="name">Label to display</param> /// <param name="street">Street</param> /// <param name="city">City</param> /// <param name="state">Sate</param> /// <param name="zip">Zip</param> /// <param name="country">Country</param> /// <param name="countryCode">Country Code if applicable</param> /// <param name="navigationType">Navigation type</param> public void NavigateTo(string name, string street, string city, string state, string zip, string country, string countryCode, NavigationType navigationType = NavigationType.Default) { if (string.IsNullOrWhiteSpace(name)) { name = string.Empty; } if (string.IsNullOrWhiteSpace(street)) { street = string.Empty; } if (string.IsNullOrWhiteSpace(city)) { city = string.Empty; } if (string.IsNullOrWhiteSpace(state)) { state = string.Empty; } if (string.IsNullOrWhiteSpace(zip)) { zip = string.Empty; } if (string.IsNullOrWhiteSpace(country)) { country = string.Empty; } var mapsDirectionsTask = new MapsDirectionsTask(); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. var lml = new LabeledMapLocation(string.Format("{0}%20{1},%20{2}%20{3}%20{4}", street, city, state, zip, country), null); mapsDirectionsTask.End = lml; // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point. mapsDirectionsTask.Show(); }
public void ShowMapsDirections() { #if WP8 if (MessageGeo == null || MessageGeo.From == null) { return; } var user = MessageGeo.From as TLUserBase; if (user == null) { return; } var label = user.FullName; if (string.IsNullOrEmpty(label)) { return; } var mediaGeo = MessageGeo.Media as TLMessageMediaGeo; if (mediaGeo == null) { return; } var geoPoint = mediaGeo.Geo as TLGeoPoint; if (geoPoint == null) { return; } var task = new MapsDirectionsTask { End = new LabeledMapLocation(user.FullName, new GeoCoordinate(geoPoint.Lat.Value, geoPoint.Long.Value)) }; task.Show(); #endif }
private void directionTask_Click(object sender, EventArgs e) { LabeledMapLocation start = null; LabeledMapLocation end = null; if (!string.IsNullOrEmpty(departureTerm.Text)) start = new LabeledMapLocation { Label = departureTerm.Text }; if (!string.IsNullOrEmpty(destinationTerm.Text)) end = new LabeledMapLocation { Label = destinationTerm.Text }; if (start == null && end == null) { MessageBox.Show("Please enter start and/or end locations."); return; } var task = new MapsDirectionsTask { Start = start, End = end }; task.Show(); }
public MenuPage() { InitializeComponent(); myMapControl.Mode = new RoadMode(); _mapProcess = new common.MapsProcess(); _mapProcess.RouteChanged += _mapProcess_RouteChanged; _mapProcess.LocatorPositionChanged += _mapProcess_LocatorPositionChanged; _mapProcess.LocatorStatusChanged += _mapProcess_LocatorStatusChanged; _mapProcess.Initialize(); _mapStatus = new common.MapStatusInfo(); MapStatusNoti.DataContext = _mapStatus; _SqLite = new DataSqliteModel(); _ImagesData = _SqLite.ReadAllProblemHistory(); UCImages = new CustomerImages(); LayoutRoot.Children.Add(UCImages); _JsonParsing = new DataParsing.JSONParsing(); MapsDirectionsTask mapsDirectionsTask = new MapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. GeoCoordinate spaceNeedleLocation = new GeoCoordinate(16.4692079, 107.567869); LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation); GeoCoordinate spaceNeedleLocation1 = new GeoCoordinate(16.470819, 107.571595); LabeledMapLocation spaceNeedleLML1 = new LabeledMapLocation("Space Needle2", spaceNeedleLocation1); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. // LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", null); mapsDirectionsTask.Start = spaceNeedleLML1; mapsDirectionsTask.End = spaceNeedleLML; // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point. mapsDirectionsTask.Show(); }
private async void navigate() { if (!String.IsNullOrEmpty(DeviceStatus.DeviceManufacturer) && DeviceStatus.DeviceManufacturer.Equals("nokia", StringComparison.InvariantCultureIgnoreCase)) { string navigateNokiaMaps = "guidance-drive://v2.0/navigate/destination/?latlon=12.992620,77.582566&zoom=16&title=The%20Lalit"; await Windows.System.Launcher.LaunchUriAsync(new Uri(navigateNokiaMaps)); } else { var mapsDirectionsTask = new MapsDirectionsTask(); mapsDirectionsTask.End = new LabeledMapLocation("The Lalit", new GeoCoordinate(12.992620, 77.582566)); mapsDirectionsTask.Show(); } }
private void Go_Click(object sender, RoutedEventArgs e) { string endLocation = End.Text; MapsDirectionsTask mapsDirectionsTask = new MapsDirectionsTask(); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. LabeledMapLocation endLocationLML = new LabeledMapLocation(endLocation, null); // If mapsDirectionsTask.Start is not set, the user's current location // is used as start point. mapsDirectionsTask.End = endLocationLML; mapsDirectionsTask.Show(); }
private void Address_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MapsDirectionsTask mdt = new MapsDirectionsTask(); mdt.End = new LabeledMapLocation(item.Name, item.Location); mdt.Show(); }
public void ShowMapsDirections() { #if WP8 if (MessageGeo == null) { return; } var message = MessageGeo as TLMessage; if (message != null) { var mediaVenue = message.Media as TLMessageMediaVenue; if (mediaVenue != null) { var label = mediaVenue.Title.ToString(); if (string.IsNullOrEmpty(label)) { return; } var geoPoint = mediaVenue.Geo as TLGeoPoint; if (geoPoint == null) { return; } var task = new MapsDirectionsTask { End = new LabeledMapLocation(label, new GeoCoordinate(geoPoint.Lat.Value, geoPoint.Long.Value)) }; task.Show(); return; } var mediaGeo = message.Media as TLMessageMediaGeo; if (mediaGeo != null) { var label = GetLabel(); if (string.IsNullOrEmpty(label)) { return; } var geoPoint = mediaGeo.Geo as TLGeoPoint; if (geoPoint == null) { return; } var task = new MapsDirectionsTask { End = new LabeledMapLocation(label, new GeoCoordinate(geoPoint.Lat.Value, geoPoint.Long.Value)) }; task.Show(); } } var decryptedMessage = MessageGeo as TLDecryptedMessage; if (decryptedMessage != null) { var mediaVenue = decryptedMessage.Media as TLDecryptedMessageMediaVenue; if (mediaVenue != null) { var label = mediaVenue.Title.ToString(); if (string.IsNullOrEmpty(label)) { return; } var geoPoint = mediaVenue.Geo as TLGeoPoint; if (geoPoint == null) { return; } var task = new MapsDirectionsTask { End = new LabeledMapLocation(label, new GeoCoordinate(geoPoint.Lat.Value, geoPoint.Long.Value)) }; task.Show(); return; } var mediaGeo = decryptedMessage.Media as TLDecryptedMessageMediaGeoPoint; if (mediaGeo != null) { var label = GetLabel(); if (string.IsNullOrEmpty(label)) { return; } var geoPoint = mediaGeo.Geo as TLGeoPoint; if (geoPoint == null) { return; } var task = new MapsDirectionsTask { End = new LabeledMapLocation(label, new GeoCoordinate(geoPoint.Lat.Value, geoPoint.Long.Value)) }; task.Show(); } } #endif }
/// <summary> /// Navigate to an address /// </summary> /// <param name="name">Label to display</param> /// <param name="street">Street</param> /// <param name="city">City</param> /// <param name="state">Sate</param> /// <param name="zip">Zip</param> /// <param name="country">Country</param> /// <param name="countryCode">Country Code if applicable</param> /// <param name="navigationType">Navigation type</param> public Task<bool> NavigateTo(string name, string street, string city, string state, string zip, string country, string countryCode, NavigationType navigationType = NavigationType.Default) { try { if (string.IsNullOrWhiteSpace(name)) name = string.Empty; if (string.IsNullOrWhiteSpace(street)) street = string.Empty; if (string.IsNullOrWhiteSpace(city)) city = string.Empty; if (string.IsNullOrWhiteSpace(state)) state = string.Empty; if (string.IsNullOrWhiteSpace(zip)) zip = string.Empty; if (string.IsNullOrWhiteSpace(country)) country = string.Empty; var mapsDirectionsTask = new MapsDirectionsTask(); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. var lml = new LabeledMapLocation(string.Format("{0}%20{1},%20{2}%20{3}%20{4}", street, city, state, zip, country), null); mapsDirectionsTask.End = lml; // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point. mapsDirectionsTask.Show(); } catch (Exception ex) { Debug.WriteLine("Unable to launch maps: " + ex); return Task.FromResult(false); } return Task.FromResult(true); }
/// <summary> /// Navigate to an address /// </summary> /// <param name="name">Label to display</param> /// <param name="street">Street</param> /// <param name="city">City</param> /// <param name="state">Sate</param> /// <param name="zip">Zip</param> /// <param name="country">Country</param> /// <param name="countryCode">Country Code if applicable</param> /// <param name="navigationType">Navigation type</param> public void NavigateTo(string name, string street, string city, string state, string zip, string country, string countryCode, NavigationType navigationType = NavigationType.Default) { if (string.IsNullOrWhiteSpace(name)) name = string.Empty; if (string.IsNullOrWhiteSpace(street)) street = string.Empty; if (string.IsNullOrWhiteSpace(city)) city = string.Empty; if (string.IsNullOrWhiteSpace(state)) state = string.Empty; if (string.IsNullOrWhiteSpace(zip)) zip = string.Empty; if (string.IsNullOrWhiteSpace(country)) country = string.Empty; var mapsDirectionsTask = new MapsDirectionsTask(); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. var lml = new LabeledMapLocation(string.Format("{0}%20{1},%20{2}%20{3}%20{4}", street, city, state, zip, country), null); mapsDirectionsTask.End = lml; // If mapsDirectionsTask.Start is not set, the user's current location is used as the start point. mapsDirectionsTask.Show(); }