Ejemplo n.º 1
0
        /// <summary>
        /// Add Icon on the map, based on the location stored in the database
        /// </summary>
        private void AddMapIcon(BasicGeoposition location, string pointName)
        {
            // Specify a known location.
            Geopoint snPoint = new Geopoint(location);

            // instance class Distances on Services
            Distances distance = new Distances();

            // Passing Locations to Get distances
            double dist = distance.Distance(location, MyLocation, DistanceType.Kilometers);

            // Create a MapIcon.
            MapIcon mapIcon1 = new MapIcon();

            mapIcon1.Location = snPoint;
            mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0);
            mapIcon1.Title = pointName + "\n" + dist.ToString("0.##") + " Km"; //Add name on Icon and format distance two decimal point

            mapIcon1.ZIndex = 0;

            // Add the MapIcon to the map.
            mapWithMyLocation.MapElements.Add(mapIcon1);
        }