示例#1
0
 private void ApplicationBarMapButton_Click(object sender, EventArgs e)
 {
     Location end = (DataContext as Appointment).location;
     var task = new BingMapsDirectionsTask();
     task.End = new LabeledMapLocation(end.title, new GeoCoordinate(end.latitude, end.longitude));
     task.Show();
 }
示例#2
0
        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();
        }
示例#3
0
 private void TextBlock_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
 {
     BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
     LabeledMapLocation destination = new LabeledMapLocation();
     bingMapsDirectionsTask.End = destination;
     bingMapsDirectionsTask.Show();
 }
示例#4
0
 private void map_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
     VenueViewModel venue = DataContext as VenueViewModel;
     bingMapsDirectionsTask.End = new LabeledMapLocation(venue.Name, venue.Location);
     bingMapsDirectionsTask.Show();
 }
示例#5
0
        private void btnNavigation_Click(object sender, EventArgs e)
        {
            var bingMapsDirectionsTask = new BingMapsDirectionsTask();
            var location = new LabeledMapLocation(App.ViewModel.SelectedLocation.Name, new GeoCoordinate(App.ViewModel.SelectedLocation.Latitude, App.ViewModel.SelectedLocation.Longitude));
            bingMapsDirectionsTask.End = location;

            bingMapsDirectionsTask.Show();
        }
示例#6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var bingTask = new BingMapsDirectionsTask();
            var mapLocationLabel = new LabeledMapLocation(InputBox.Text, null);
            bingTask.End = mapLocationLabel;

            bingTask.Show();
        }
示例#7
0
文件: Helper.cs 项目: JanJoris/Track
 private void OpenDefaultmaps(Station station)
 {
     var bingMapsDirectionsTask = new BingMapsDirectionsTask();
     var mapLocation = new LabeledMapLocation(string.Format(AppResources.NavigationStation, station.Name), station.GeoCoordinate);
     bingMapsDirectionsTask.End = mapLocation;
     // If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point.
     bingMapsDirectionsTask.Show();
 }
 private async void navigate()
 {
     
         var bingMapsDirectionsTask = new BingMapsDirectionsTask();
         bingMapsDirectionsTask.End = new LabeledMapLocation("The Lalit", new GeoCoordinate(12.992620, 77.582566));
         bingMapsDirectionsTask.Show();
     
 }
示例#9
0
        private void buttonRota_Click(object sender, RoutedEventArgs e)
        {
            BingMapsDirectionsTask rota = new BingMapsDirectionsTask();
            LabeledMapLocation a = new LabeledMapLocation("FIAP-Lins", new System.Device.Location.GeoCoordinate(-23.5741, -46.6232));
            LabeledMapLocation b = new LabeledMapLocation("FIAP-Paulista", new System.Device.Location.GeoCoordinate(-23.5648, -46.6325));

            rota.Start = a;
            rota.End = b;
            rota.Show();
        }
示例#10
0
        private void FindDirections(object sender, EventArgs e)
        {
            BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();

            GeoCoordinate hsgLocation = new GeoCoordinate(Latitude, Longitude);
            LabeledMapLocation hsgLML = new LabeledMapLocation("Hackerspace.SG", hsgLocation);

            bingMapsDirectionsTask.End = hsgLML;

            bingMapsDirectionsTask.Show();
        }
示例#11
0
        private void txtDescription_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();

            LabeledMapLocation start = new LabeledMapLocation("My Location", new GeoCoordinate(Convert.ToDouble(NavigationContext.QueryString["lat1"]), Convert.ToDouble(NavigationContext.QueryString["lon1"])));
            bingMapsDirectionsTask.Start = start;

            LabeledMapLocation end = new LabeledMapLocation(NavigationContext.QueryString["name"], new GeoCoordinate(Convert.ToDouble(NavigationContext.QueryString["lat2"]), Convert.ToDouble(NavigationContext.QueryString["lon2"])));
            bingMapsDirectionsTask.End = end;

            bingMapsDirectionsTask.Show();
        }
示例#12
0
        public void navigateTo(string options)
        {
            var args = JsonHelper.Deserialize<string[]>(options);
            var location = JsonHelper.Deserialize<Location>(args[0]);

            var directions = new BingMapsDirectionsTask
            {
                End = new LabeledMapLocation("Destination", new GeoCoordinate(location.Latitude, location.Longitude))
            };
            directions.Show();
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            BingMapsDirectionsTask _rota = new BingMapsDirectionsTask();

            LabeledMapLocation origem = 
                new LabeledMapLocation("FIAP-Lins", new GeoCoordinate(-23.5741, -46.6232));
            LabeledMapLocation destino =
                new LabeledMapLocation("FIAP-Paulista", new GeoCoordinate(-23.5648, -46.6525));

            _rota.Start = origem;
            _rota.End = destino;

            _rota.Show();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;
            string location = (string)button.CommandParameter;

            // instantie
            BingMapsDirectionsTask bingTask = new BingMapsDirectionsTask();

            // properties
            LabeledMapLocation lml = new LabeledMapLocation(location, null);
            bingTask.End = lml;

            //show
            bingTask.Show();
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();

            // You can specify a label and a geocoordinate for the end point.
            // GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493);
            // LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);

            // If you set the geocoordinate parameter to null, the label parameter is used as a search term.
            LabeledMapLocation spaceNeedleLML = new LabeledMapLocation(textBox1.Text, null);

            bingMapsDirectionsTask.End = spaceNeedleLML;

            // If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point.

            bingMapsDirectionsTask.Show();
        }
        private async void btnMapas_Click(object sender, RoutedEventArgs e)
        {
            
            var locator = new Geolocator();
            //MessageBox.Show("¿Está seguro de querer abrir Mapas?", "Cómo llegar.",MessageBoxButton.OKCancel);

            MessageBoxResult m = MessageBox.Show("Trazar una ruta hacia el museo.", "¿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("Ubicación actual", new GeoCoordinate(Latitud2, Longitud2)),
                    End = new LabeledMapLocation("Galería de Arte del Palacio", new GeoCoordinate(19.044078, -98.197776))
                };
                // Launching Bing Maps Direction Tasks
                bing.Show();
            }
        }
示例#17
0
        public void getDirections(string options)
        {
            string[] args = JsonHelper.Deserialize<string[]>(options);
            string callbackId = args[1];

            GetDirectionsOptions directionOptions = JsonHelper.Deserialize<GetDirectionsOptions>(args[0]);

            BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();

            // You can specify a label and a geocoordinate for the end point.
            if (directionOptions.Start != null)
            {
                LabeledMapLocation startLML = new LabeledMapLocation();
                if (directionOptions.Start.Coordinates != null)
                {
                    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();
            DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
        }
        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();
        }
        public static void ShowDirections(Entity target)
        {
            var originalCulture = Thread.CurrentThread.CurrentCulture.Name;
            try
            {
                var task = new BingMapsDirectionsTask
                               {
                                   Start = new LabeledMapLocation(AppResources.StartLocationMapDirections, DeviceLocationInfo.Current.CurrentCoordinates),
                                   End = new LabeledMapLocation(target.Title, target.GetGeoCoordinates())
                               };

                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                task.Show();
            }
            finally
            {
                // Switch back to the culture we had before
                Thread.CurrentThread.CurrentCulture = new CultureInfo(originalCulture);
            }
        }
示例#20
0
        private void DeliveryAddressButton_Click(object sender, RoutedEventArgs e)
        {
            var source = (Button)e.OriginalSource;
            var selectedDelivery = (Delivery)source.DataContext;

            var mapDirectionsTask = new BingMapsDirectionsTask();

            LabeledMapLocation originatingLocation;
            var currentLocation = new GeoCoordinateWatcher(GeoPositionAccuracy.Default).Position;
            if (currentLocation == null || currentLocation.Location.IsUnknown)
            {
                currentLocation.Location = new GeoCoordinate(53.579022, -113.522769);
            }

            originatingLocation = new LabeledMapLocation("Current Location", currentLocation.Location);

            var desintation = new LabeledMapLocation(selectedDelivery.Address.ToString(), null);

            mapDirectionsTask.Start = originatingLocation;
            mapDirectionsTask.End = desintation;

            mapDirectionsTask.Show();
        }
        private void NavigateToStart()
        {
            // Creates a new Bing Maps task.
            BingMapsDirectionsTask task = new BingMapsDirectionsTask();
            task.End = new LabeledMapLocation(
                String.Format("Starting Location for {0}", Cartridge.Name),
                StartingCoordinate);

            // Starts the task.
            task.Show();
        }
        private async void TracarRota(string nomeCliente, double latitudeCliente, double longitudeCliente)
        {
            Geolocator geolocator = new Geolocator();
            geolocator.DesiredAccuracyInMeters = 50;

            try
            {
                Geoposition geoposition = await geolocator.GetGeopositionAsync(
                    maximumAge: TimeSpan.FromMinutes(5),
                    timeout: TimeSpan.FromSeconds(10)
                 );

                Geopoint localizacao = geoposition.Coordinate.Point;
                double latitudeUsuario = localizacao.Position.Latitude;
                double longitudeUsuario = localizacao.Position.Longitude;

                BingMapsDirectionsTask rota = new BingMapsDirectionsTask();
                LabeledMapLocation a = new LabeledMapLocation("Sua posição", new System.Device.Location.GeoCoordinate(latitudeUsuario, longitudeUsuario));
                LabeledMapLocation b = new LabeledMapLocation(nomeCliente, new System.Device.Location.GeoCoordinate(latitudeCliente, longitudeCliente));
                rota.Start = a;
                rota.End = b;
                rota.Show();
            }
            catch
            {
                MessageBox.Show("Falha em determinar localização do dispositivo");
            }
        }
示例#23
0
        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();
            }
        }
        private void OpenInBingMaps()
        {
            if (_itemLocation != null)
            {
                double zoom = 18.0;

                /*if (AppPlatform.IsMango)
                {
                    var bingMaps = ((App)(App.Current)).Mango.Tasks.CreateBingMapsTask();
                    bingMaps.Center = center;
                    bingMaps.ZoomLevel = zoom;
                    worked = true;
                    bingMaps.Show();
                }
                else*/
                if (_placePushpin != null && _placePushpin.Content is MapPlaceInformation)
                {
                    var mpi = _placePushpin.Content as MapPlaceInformation;
                    if (mpi != null)
                    {
                        var bing = new BingMapsDirectionsTask();
                        bing.End = new LabeledMapLocation
                        {
                            Label = mpi.Name,
                            Location = _placePushpin.Location
                        };
                        try
                        {
                            bing.Show();
                        }
                        catch
                        {
                            MessageBox.Show("On some phones the map cannot be opened. Your culture may be set to a non-English culture where a known bug exists.", "Sorry!", MessageBoxButton.OK);
                        }
                    }
                }
                else if (MangoOnSeven.IsMangoRunning)
                {
                    try
                    {
                        MangoOnSeven.TryBingMapsTask(_itemLocation, zoom);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("On some phones the map cannot be opened. Your culture may be set to a non-English culture where a known bug exists.", "Sorry!", MessageBoxButton.OK);
                    }
                }
            }
        }
示例#25
0
        private void appBarGetDirections_Click(object sender, EventArgs e)
        {
            BingMapsDirectionsTask mapDirectionTask = new BingMapsDirectionsTask
            {
                //Start = new LabeledMapLocation("My Location", new GeoCoordinate(App.JobVM.JobInfo.LocationLatitude, App.JobVM.JobInfo.)),
                End = new LabeledMapLocation(App.JobVM.JobInfo.Company, new GeoCoordinate(App.JobVM.JobInfo.LocationLatitude, App.JobVM.JobInfo.LocationLongitude))
            };

            mapDirectionTask.Show();
        }
 private void GoToTherondelsButtonClick(object sender, RoutedEventArgs e)
 {
     var direction = new BingMapsDirectionsTask
         {
             End = new LabeledMapLocation( "Therondels, 12600", new GeoCoordinate(44.895419, 2.757676))
         };
     direction.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 void GetDirectionsExecute()
        {
            if (ToDoItem == null)
            {
                return;
            }
            string locationAddressToNavigate = ToDoItem.LocationAddress;
            double latitude = ToDoItem.LocationLatitude;
            double longitude = ToDoItem.LocationLongitude;

            GeoCoordinate geoCoordinate = new GeoCoordinate(latitude, longitude);
            BingMapsDirectionsTask directionsTask = new BingMapsDirectionsTask();

            LabeledMapLocation labeledMapLocation = new LabeledMapLocation(locationAddressToNavigate, geoCoordinate);
            directionsTask.End = labeledMapLocation;
            directionsTask.Show();
        }
示例#29
0
 /// <summary>
 /// Handles the Click event of the navigateButton control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
 private void navigateButton_Click(object sender, RoutedEventArgs e)
 {
     BingMapsDirectionsTask directionTask = new BingMapsDirectionsTask();
         directionTask.End = new LabeledMapLocation("Car", location.Coordinate);
         directionTask.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();
 }