Пример #1
0
        private void GenerateMap(ICollection<Ambassador> ambs)
        {
            //create map and set it at the highest zoom possible and center on current location.

            Map worldMap = new Map (MapSpan.FromCenterAndRadius (
                ToPosition (Location.XamarinHQ), Distance.FromKilometers (double.MaxValue)));

            if (ambs != null)
            {
                foreach (var amb in ambs)
                {
                    var location = new Location(amb);

                    worldMap.Pins.Add(new Pin()
                    {
                        Position = ToPosition(location),
                        Type = PinType.Generic,
                        Label = amb.FirstName + " " + amb.LastName,
                        Address = location.LocationString
                    });
                }
            }

            worldMap.IsShowingUser = false;
            worldMap.MapType = MapType.Street;
            var layout = ((StackLayout)Content);
            layout.Children.RemoveAt(0);
            layout.Children.Add(worldMap);
        }
Пример #2
0
 private static Position ToPosition(Location location)
 {
     return new Position (location.Cooridinates.Latitude, location.Cooridinates.Longitude);
 }