Example #1
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();
 }
    /// <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();
    }
Example #3
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();
        }
Example #4
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();
        }
 /// <summary>
 /// Shows the Bing Maps application with driving directions displayed for the specified starting and ending locations.
 /// </summary>
 /// <param name="startingLocation">The starting location for which driving directions are displayed.</param>
 /// <param name="endingLocation">The ending location for which driving directions are displayed.</param>
 /// <exception cref="InvalidOperationException">Start and End cannot both be invalid.</exception>
 public void Show(LabeledMapLocation startingLocation, LabeledMapLocation endingLocation)
 {
     new BingMapsDirectionsTask()
     {
         Start = startingLocation,
         End = endingLocation
     }.Show();
 }
Example #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();
        }
Example #7
0
 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();
 }
 /// <summary>
 /// Shows the Maps application with driving directions displayed for the specified ending location.
 /// </summary>
 /// <param name="endingLocation">The ending location for which driving directions are displayed.</param>
 /// <exception cref="InvalidOperationException">Start and End cannot both be invalid.</exception>
 public void Show(LabeledMapLocation endingLocation)
 {
     #if WP8
     Show(null, endingLocation);
     #else
     throw new NotSupportedException("This service is not supported in Windows Phone 7.x. Use the BingMapsService instead.");
     #endif
 }
        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();
        }
Example #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();
        }
        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(); 
        }
        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();
        }
 /// <summary>
 /// Shows the Maps application with driving directions displayed for the specified starting and ending locations.
 /// </summary>
 /// <param name="startingLocation">The starting location for which driving directions are displayed.</param>
 /// <param name="endingLocation">The ending location for which driving directions are displayed.</param>
 /// <exception cref="InvalidOperationException">Start and End cannot both be invalid.</exception>
 public void Show(LabeledMapLocation startingLocation, LabeledMapLocation endingLocation)
 {
     #if WP8
     new MapsDirectionsTask()
     {
         Start = startingLocation,
         End = endingLocation
     }.Show();
     #else
     throw new NotSupportedException("This service is not supported in Windows Phone 7.x. Use the BingMapsService instead.");
     #endif
 }
Example #14
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();
        }
 /// <summary>
 /// Shows the Maps application with driving directions displayed for the specified starting and ending locations.
 /// </summary>
 /// <param name="startingLocation">The starting location for which driving directions are displayed.</param>
 /// <param name="endingLocation">The ending location for which driving directions are displayed.</param>
 /// <exception cref="InvalidOperationException">Start and End cannot both be invalid.</exception>
 public void Show(LabeledMapLocation startingLocation, LabeledMapLocation endingLocation)
 {
     #if WP8
     new MapsDirectionsTask()
     #else
     new BingMapsDirectionsTask()
     #endif
     {
         Start = startingLocation,
         End = endingLocation
     }.Show();
 }
Example #16
0
    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 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();
        }
Example #20
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 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();
        }
Example #23
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();
        }
    /// <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();

    }
 /// <summary>
 /// Shows the Maps application with driving directions displayed for the specified ending location.
 /// </summary>
 /// <param name="endingLocation">The ending location for which driving directions are displayed.</param>
 /// <exception cref="InvalidOperationException">Start and End cannot both be invalid.</exception>
 public void Show(LabeledMapLocation endingLocation)
 {
     Show(null, endingLocation);
 }
Example #26
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();
            }
        }
 /// <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 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");
            }
        }
        /// <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);
        }
        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();
        }