Exemple #1
0
        private void UpdatePinsFromLocations()
        {
            _settingPinsFromLocations = true;
            _viewModel.Pins.Clear();
            var positions = Locations.Select(x => new TK.CustomMap.Position(x.Latitude, x.Longitude));

            foreach (var location in Locations)
            {
                _viewModel.AddPin(location.Latitude, location.Longitude, location.Description);
            }
            if (Locations.Count > 0)
            {
                MyMap.FitMapRegionToPositions(positions, true);
            }
            _settingPinsFromLocations = false;
        }
Exemple #2
0
 public void MoveToPins()
 {
     if (_viewModel.Pins.Count > 0)
     {
         var positions = new List <Position>();
         foreach (var pin in MyMap.Pins)
         {
             positions.Add(pin.Position);
         }
         if (positions.Count > 1)
         {
             MyMap.FitMapRegionToPositions(positions, true);
         }
         else
         {
             MyMap.MoveToMapRegion(MapSpan.FromCenterAndRadius(positions[0], Distance.FromMiles(2)), true);
         }
     }
 }