private void Button_gridbut_Click(object sender, RoutedEventArgs e)
        {
            if (sender == LaunchButton)
            {
                try
                {
                    DirectionsRouteDestinationTask routeTask = new DirectionsRouteDestinationTask();

                    routeTask.Origin =  new GeoCoordinate(Double.Parse(LatitudeBox1.Text),Double.Parse(LongittudeBox1.Text));;
                    routeTask.Destination =  new GeoCoordinate(Double.Parse(LatitudeBox2.Text),Double.Parse(LongittudeBox2.Text));;

                    routeTask.Show();
                }
                catch (Exception erno)
                {
                    MessageBox.Show("Error message: " + erno.Message);
                }

            }
            else if (sender == getGeoButton1)
            {

                NavigationService.Navigate(new Uri("/LocationSelectorPage.xaml?target=Origin", UriKind.Relative));
            }
            else if (sender == getGeoButton2)
            {

                NavigationService.Navigate(new Uri("/LocationSelectorPage.xaml?target=Destination", UriKind.Relative));
            }
        }
        private void btnDirectionsRouteDestinationTask_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DirectionsRouteDestinationTask routeTask = new DirectionsRouteDestinationTask();
                routeTask.Origin = new GeoCoordinate(LatitudSevilla, LongitudSevilla); 
                routeTask.Destination = new GeoCoordinate(LatitudMadrid, LongitudMadrid);

                routeTask.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error message: " + ex.Message);
            }
        }
Beispiel #3
0
        private void OnShowDirectionsMessageReceived(ShowDirectionsMessage message)
        {
            string text = "";
            if (message.Name != null)
                text = string.Format(AppResources.NearestMuseumFoundMessage, message.Name);
            text += AppResources.ContinueToHereMapsMessage;

            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Caption = AppResources.GetDirectionsMessage,
                Message = text,
                LeftButtonContent = AppResources.ContinueButtonLabel,
                RightButtonContent = AppResources.CancelButtonLabel,
            };

            messageBox.Dismissed += (s1, e1) =>
            {
                switch (e1.Result)
                {
                    case CustomMessageBoxResult.LeftButton:
                        DirectionsRouteDestinationTask driveTo = new DirectionsRouteDestinationTask();
                        driveTo.Destination = message.Coordinate;
                        driveTo.Mode = RouteMode.Car;
                        driveTo.Show();
                        break;
                    default:
                        break;
                }
            };

            messageBox.Show();
        }
Beispiel #4
0
 private void OpenHereMaps(Station station)
 {
     var routeTo = new DirectionsRouteDestinationTask
     {
         Destination = station.GeoCoordinate,
         Mode = RouteMode.Unknown
     };
     routeTo.Show();
 }