Esempio n. 1
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains("latival"))
                {
                    string valu =
                        IsolatedStorageSettings.ApplicationSettings["latival"] as string;
                }
                if (IsolatedStorageSettings.ApplicationSettings.Contains("lonval"))
                {
                    string value =
                        IsolatedStorageSettings.ApplicationSettings["lonval"] as string;
                }
                double val  = Convert.ToDouble(latival);
                double val1 = Convert.ToDouble(lonval);

                DirectionsRouteDestinationTask routeTo = new DirectionsRouteDestinationTask();
                routeTo.Destination = new GeoCoordinate(val, val1);
                routeTo.Mode        = RouteMode.Car;
                routeTo.Show();
            }
            catch (Exception ex)
            {
                if ((uint)ex.HResult == 0x80004004)
                {
                    Status.Text = "location is disabled in phone settings.";
                }
                //else
                {
                    // something else happened during the acquisition of the location
                }
            }
        }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
        private void BtnDirectionsOnTap(object sender, GestureEventArgs gestureEventArgs)
        {
            try
            {
                DirectionsRouteDestinationTask routeTo = new DirectionsRouteDestinationTask();

                var venue = Helper.venues[_currentVenueControlId];
                routeTo.Destination = new GeoCoordinate(Double.Parse(venue.latitude), Double.Parse(venue.longitude));
                routeTo.Mode        = RouteMode.Car;
                routeTo.Show();
            }
            catch (Exception erno)
            {
                MessageBox.Show("Error message: " + erno.Message);
            }
        }
        void callHereLauncher(GeoCoordinateInfo stationGeoCoordinate, int callType) // 1 - route direction, 2 - driving guidence, 3 - walking guidence
        {
            try
            {
                switch (callType)
                {
                case 1:
                    DirectionsRouteDestinationTask routeTo = new DirectionsRouteDestinationTask();
                    routeTo.Destination = stationGeoCoordinate;
                    routeTo.Mode        = RouteMode.Car;
                    routeTo.Show();
                    break;

                case 2:
                    GuidanceDriveTask driveTo = new GuidanceDriveTask();
                    driveTo.Destination = stationGeoCoordinate;
                    driveTo.Title       = stationGeoCoordinate.locationName;
                    driveTo.Show();

                    break;

                case 3:
                    GuidanceWalkTask walkTo = new GuidanceWalkTask();
                    walkTo.Destination = stationGeoCoordinate;
                    walkTo.Title       = stationGeoCoordinate.locationName;
                    walkTo.Show();
                    break;

                default:
                    break;
                }
            }
            catch (Exception erno)
            {
                if (callType == 1 || callType == 3)
                {
                }
                else
                {
                }
                MessageBox.Show("Error!");
            }
        }
Esempio n. 5
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            try
            {
                //Geolocator geolocator = new Geolocator();
                //geolocator.DesiredAccuracyInMeters = 50;


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

                //With this 2 lines of code, the app is able to write on a Text Label the Latitude and the Longitude, given by {{Icode|geoposition}}
                //double lat = Convert.ToDouble(geoposition.Coordinate.Latitude.ToString("0.00"));
                //double lon = Convert.ToDouble(geoposition.Coordinate.Longitude.ToString("0.00"));


                //MapsDirectionsTask mapsDirectionTask = new MapsDirectionsTask();
                //mapsDirectionTask.Start = new LabeledMapLocation("", new GeoCoordinate(lat, lon));
                //mapsDirectionTask.End = new LabeledMapLocation("End", new GeoCoordinate(latival, lonval));
                //mapsDirectionTask.Show();

                DirectionsRouteDestinationTask routeTo = new DirectionsRouteDestinationTask();
                routeTo.Destination = new GeoCoordinate(latival, lonval);
                routeTo.Mode        = RouteMode.Car;
                routeTo.Show();
            }
            catch (Exception ex)
            {
                if ((uint)ex.HResult == 0x80004004)
                {
                    Status.Text = "location is disabled in phone settings.";
                }
                //else
                {
                    // something else happened during the acquisition of the location
                }
            }
        }
Esempio n. 6
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();
        }