private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e) { if (e.Position.Location.IsUnknown) { MessageBox.Show("Please wait while your prosition is determined"); return; } if (_needDirections) { BingMapsDirectionsTask Direction = new BingMapsDirectionsTask(); LabeledMapLocation start = new LabeledMapLocation("Current Location", new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude)); LabeledMapLocation End = new LabeledMapLocation(dateViewModel.Date.Venue.Name, new GeoCoordinate(dateViewModel.Date.Venue.Latitude, dateViewModel.Date.Venue.Longitude)); Direction.Start = start; Direction.End = End; _watcher.Stop(); Direction.Show(); } else { BingMapsTask bingMapsTask = new BingMapsTask(); LabeledMapLocation currentLocation = new LabeledMapLocation("Current Location", new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude)); bingMapsTask.ZoomLevel = 10; bingMapsTask.Center = currentLocation.Location; _watcher.Stop(); bingMapsTask.Show(); } }
/// <summary> /// Event handler for the directions button /// </summary> /// <param name="sender">Sender of the event</param> /// <param name="e">Event arguments</param> private void OnDirectionsClick(object sender, EventArgs e) { try { this.UserLocationMarker.GeoCoordinate = Globals.RecentLocation.Coordinate; if (this.RouteDirectionsPushPin == null || this.RouteDirectionsPushPin.GeoCoordinate == null) { Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.MapTapHoldToGetDirections, "basicWrap", "Info!")); } else { GeoCoordinate spaceNeedleLocation = new GeoCoordinate(this.UserLocationMarker.GeoCoordinate.Latitude, this.UserLocationMarker.GeoCoordinate.Longitude); BingMapsDirectionsTask bmDirectionTask = new BingMapsDirectionsTask(); LabeledMapLocation currentLML = new LabeledMapLocation("Current location", spaceNeedleLocation); bmDirectionTask.Start = currentLML; GeoCoordinate destinationLocation = new GeoCoordinate(this.RouteDirectionsPushPin.GeoCoordinate.Latitude, this.RouteDirectionsPushPin.GeoCoordinate.Longitude); LabeledMapLocation destinationLocationLML = new LabeledMapLocation("Destination location", destinationLocation); bmDirectionTask.End = destinationLocationLML; bmDirectionTask.Show(); } } catch (Exception exception) { ExceptionHandler.ShowExceptionMessageAndLog(exception, true); } }
public void getDirections(string options) { GetDirectionsOptions directionOptions = JSON.JsonHelper.Deserialize <GetDirectionsOptions>(options); BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. if (directionOptions.Start != null) { LabeledMapLocation startLML = new LabeledMapLocation(); startLML.Location = new GeoCoordinate(directionOptions.Start.Coordinates.Latitude, directionOptions.Start.Coordinates.Longitude); if (directionOptions.Start.Label != null) { startLML.Label = directionOptions.Start.Label; } bingMapsDirectionsTask.Start = startLML; } // If you set the geocoordinate parameter to null, the label parameter is used as a search term. if (directionOptions.End != null) { LabeledMapLocation endLML = new LabeledMapLocation(); if (directionOptions.End.Coordinates != null) { endLML.Location = new GeoCoordinate(directionOptions.End.Coordinates.Latitude, directionOptions.End.Coordinates.Longitude); } if (directionOptions.End.Label != null) { endLML.Label = directionOptions.End.Label; } bingMapsDirectionsTask.End = endLML; } // If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point. bingMapsDirectionsTask.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 BingMapsDirectionsTask { Start = start, End = end }; task.Show(); } } }
private void FindRout_tap(object sender, System.Windows.Input.GestureEventArgs e) { try { if (NetworkInterface.GetIsNetworkAvailable()) { //var locationX = new GeoCoordinate(cl.latitude, cl.langitude); var locationY = new GeoCoordinate(double.Parse("" + selectedlocdata.Lat), double.Parse("" + selectedlocdata.Long)); BingMapsDirectionsTask directionTask = new BingMapsDirectionsTask(); directionTask.End = new LabeledMapLocation("" + selectedlocdata.D_name, locationY); // directionTask.Start = new LabeledMapLocation("My Location", locationX); directionTask.Show(); } else { MessageBox.Show("Network is not available."); } } catch { } }
private void OpenDirectionTo(GeoCoordinate locationY) { BingMapsDirectionsTask directionTask = new BingMapsDirectionsTask(); directionTask.End = new LabeledMapLocation("Your tapped location", locationY); directionTask.Show(); }
private async void ContextMenu_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = sender as MenuItem; if (menuItem != null && ((sender as MenuItem).DataContext is PointOfInterest)) { PointOfInterest poiSelected = (sender as MenuItem).DataContext as PointOfInterest; switch (menuItem.Name) { case "POIGet": try { ViewModel.Loading = true; BingMapsDirectionsTask bingMap = new BingMapsDirectionsTask(); // Get my current location. Geolocator myGeolocator = new Geolocator(); Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync(); Geocoordinate myGeocoordinate = myGeoposition.Coordinate; bingMap.Start = new LabeledMapLocation(); bingMap.End = new LabeledMapLocation(); bingMap.Start.Label = AppResources.YourPosition; bingMap.Start.Location = new GeoCoordinate(myGeocoordinate.Point.Position.Latitude, myGeocoordinate.Point.Position.Longitude); bingMap.End.Location = poiSelected.Coordinate; bingMap.End.Label = poiSelected.Name; bingMap.Show(); ViewModel.Loading = false; } catch (Exception) { // the app does not have the right capability or the location master switch is off MessageBox.Show(AppResources.LocationError, AppResources.Warning, MessageBoxButton.OK); } break; case "POIShare": ShareStatusTask status = new ShareStatusTask(); status.Status = String.Format(AppResources.IamHere, poiSelected.Name); status.Show(); break; case "POIPictures": ViewModel.ListPhotoCommand.Execute(poiSelected); break; case "POINotes": ViewModel.ListNoteCommand.Execute(poiSelected); break; case "EditPoi": ViewModel.EditPOICommand.Execute(new Tuple <int, Mode>(poiSelected.Id, Mode.edit)); break; case "DeletePOI": ConfirmDeletePOI(poiSelected); break; } } }
public static void GetDirections(GeoCoordinate end) { BingMapsDirectionsTask task = new BingMapsDirectionsTask(); task.Start = new LabeledMapLocation(AppResources.GPS_CurrentPosition, new GeoCoordinate(staticObjects.CurrentLatitude, staticObjects.CurrentLongitude)); task.End = new LabeledMapLocation(AppResources.GPS_EndPosition, end); task.Show(); }
private void Directions_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { BingMapsDirectionsTask bmdt = new BingMapsDirectionsTask(); bmdt.Start = new LabeledMapLocation("8800 Lyra Ave, Columbus, OH 43240", new GeoCoordinate()); bmdt.End = new LabeledMapLocation("Thurman's Cafe, Columbus, OH", new GeoCoordinate()); bmdt.Show(); }
private async void btnRuta_Click(object sender, RoutedEventArgs e) { Museo museo = NavigateServiceExtends.GetNavigationData(NavigationService) as Museo; this.DataContext = museo; var nombreMuseo = museo.nombre; var lat = museo.latitud; var lon = museo.longitud; double latitudMuseo; double longitudMuseo; latitudMuseo = Convert.ToDouble(lat); longitudMuseo = Convert.ToDouble(lon); var locator = new Geolocator(); //MessageBox.Show("¿Está seguro de querer abrir Mapas?", "Cómo llegar.",MessageBoxButton.OKCancel); MessageBoxResult m = MessageBox.Show("Trazar una ruta a " + nombreMuseo, "¿Quieres saber cómo llegar?", MessageBoxButton.OKCancel); if (m == MessageBoxResult.Cancel) { } else { //MessageBox.Show("Data Deleted", "Done", MessageBoxButton.OK); String Latitud; String Longitud; if (!locator.LocationStatus.Equals(PositionStatus.Disabled)) { var position = await locator.GetGeopositionAsync(); Latitud = position.Coordinate.Point.Position.Latitude.ToString(); Longitud = position.Coordinate.Point.Position.Longitude.ToString(); } else { return; } double Latitud2 = Convert.ToDouble(Latitud); double Longitud2 = Convert.ToDouble(Longitud); BingMapsDirectionsTask bing = new BingMapsDirectionsTask() { //Giving label and coordinates to starting and ending points. Start = new LabeledMapLocation("Tu posición actual", new GeoCoordinate(Latitud2, Longitud2)), End = new LabeledMapLocation(nombreMuseo, new GeoCoordinate(latitudMuseo, longitudMuseo)) }; // Launching Bing Maps Direction Tasks bing.Show(); } }
private void Directions(object sender, EventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation("Aeropuerto Internacional de Ezeiza \"Ministro Pistarini\"", new GeoCoordinate(-34.812393945083, -58.5363578796387)) }; bingMapsDirectionsTask.Show(); }
// Click directions appbar button private void abDirections_Click(object sender, EventArgs e) { // Windows Phone Task to show directions BingMapsDirectionsTask bmdTask = new BingMapsDirectionsTask(); LabeledMapLocation destinationLocation = new LabeledMapLocation("End", destination); LabeledMapLocation startLocation = new LabeledMapLocation("Start", departure); bmdTask.Start = startLocation; // Start location is current user's location bmdTask.End = destinationLocation; // Destination location is location that was shared with the current user bmdTask.Show(); // Show directions }
private void Directions(object sender, EventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation("Aeroparque Internacional \"Jorge Newbery\"", new GeoCoordinate(-34.5584560886206, -58.4167098999023)) }; bingMapsDirectionsTask.Show(); }
/// <summary> /// to display distance b/w selected location from current location on map. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbkDistance_Tap(object sender, System.Windows.Input.GestureEventArgs e) { var selectedCategory = (this.DataContext as CityData); BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask(); LabeledMapLocation start = new LabeledMapLocation(); LabeledMapLocation end = new LabeledMapLocation(selectedCategory.Address, new GeoCoordinate(selectedCategory.Coordinate.Latitude, selectedCategory.Coordinate.Longitude)); bingMapsDirectionsTask.Start = start; bingMapsDirectionsTask.End = end; bingMapsDirectionsTask.Show(); }
private void Directions(object sender, EventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( String.Format("Estación {0}", _bicicletaEstacion.Nombre), new GeoCoordinate(_bicicletaEstacion.Latitud, _bicicletaEstacion.Longitud)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_GonzalezCatan_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Gonzalez Catán", new GeoCoordinate(-34.79333, -58.632054)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_LaPlata_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - La Plata", new GeoCoordinate(-34.911458, -57.95567)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Ensenada_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Ensenada", new GeoCoordinate(-34.856984, -57.907568)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_AlmiranteBrown_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Almirante Brown", new GeoCoordinate(-34.802598, -58.401883)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_RafaelCalzada_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Rafael Calzada", new GeoCoordinate(-34.677776, -58.36695)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Ezeiza_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Ezeiza", new GeoCoordinate(-34.891486, -58.569890)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Tigre_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Tigre", new GeoCoordinate(-34.455204, -58.634865)) }; bingMapsDirectionsTask.Show(); }
private void bingDirectionTask(object sender, RoutedEventArgs e) { BingMapsDirectionsTask bingDirectionTask = new BingMapsDirectionsTask(); //Start metodunu kullanmadığınız takdirde kullanıcının bulunduğu konum başlangıç noktası olarak set edilir. bingDirectionTask.Start = new LabeledMapLocation(start.Text.ToString(), null); //LabeledMapLocatıon classı'nın ikinci parametresini null geçtiğiniz zaman, konum arama servisine yönlendirilerek koordinat alırsınız. //Custom koordinat değeri atamak için yukarıdaki örnekte olduğu gibi GeoCoordinate classı'ndan faydalanabilirsiniz. bingDirectionTask.End = new LabeledMapLocation(end.Text.ToString(), null); bingDirectionTask.Show(); }
private void Hyperlink_SIGEN_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - SIGEN", new GeoCoordinate(-34.637145, -58.527989)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Caballito_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Caballito", new GeoCoordinate(-34.610857, -58.435512)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Congreso_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Congreso", new GeoCoordinate(-34.605462, -58.3922)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Moron_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Morón", new GeoCoordinate(-34.650403, -58.621867)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Temperley_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Temperley", new GeoCoordinate(-34.774918, -58.397951)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Constitucion_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Contitución", new GeoCoordinate(-34.630921, -58.382673)) }; bingMapsDirectionsTask.Show(); }
private void Hyperlink_Lanus_OnClick(object sender, RoutedEventArgs e) { var bingMapsDirectionsTask = new BingMapsDirectionsTask { End = new LabeledMapLocation( "SUBE - Lanús", new GeoCoordinate(-34.699623, -58.392168)) }; bingMapsDirectionsTask.Show(); }