Exemplo n.º 1
0
        private void PinOnClicked(object sender, EventArgs e)
        {
            Pin clickedPin = sender as Pin;

            if (clickedPin != null)
            {
                Location clickedLocation = _viewModel.LocationItems.SingleOrDefault(l => l.Name == clickedPin.Label);
                LocationCollectionView.ScrollTo(clickedLocation, position: ScrollToPosition.Start);
            }
        }
Exemplo n.º 2
0
 private void LocationsMap_OnPinClicked(object sender, PinClickedEventArgs e)
 {
     if (e.Pin != null)
     {
         Location clickedLocation = _viewModel.LocationItems.SingleOrDefault(l => l.Name == (e.Pin).Label);
         if (clickedLocation != null)
         {
             LocationCollectionView.ScrollTo(clickedLocation, position: ScrollToPosition.Start);
         }
     }
 }
        private void LocationsMap_OnPinClicked(object sender, PinClickedEventArgs e)
        {
            if (e.Pin != null)
            {
                LocationCollectionView.ScrollTo(0);
                _viewModel.NearbyPictures.Clear();
                Picture clickedPicture = e.Pin.Tag as Picture;
                if (clickedPicture != null)
                {
                    double clickedLat;
                    bool   clickedLatValid = double.TryParse(clickedPicture.Latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out clickedLat);
                    double clickedLon;
                    bool   clickedLonValid = double.TryParse(clickedPicture.Longtitude, NumberStyles.Any, CultureInfo.InvariantCulture, out clickedLon);

                    if (clickedLatValid && clickedLonValid)
                    {
                        foreach (Picture picture in _viewModel.PictureItems)
                        {
                            double lat;
                            bool   validLat = double.TryParse(picture.Latitude, NumberStyles.Any, CultureInfo.InvariantCulture, out lat);
                            double lon;
                            bool   validLon = double.TryParse(picture.Longtitude, NumberStyles.Any, CultureInfo.InvariantCulture, out lon);
                            if (validLat && validLon)
                            {
                                var distance = DistanceCalculation.GeoCodeCalc.CalcDistance(clickedLat, clickedLon, lat,
                                                                                            lon, DistanceCalculation.GeoCodeCalcMeasurement.Kilometers);
                                if (distance < _viewModel.NearbyDistance)
                                {
                                    _viewModel.NearbyPictures.Add(picture);
                                }
                            }
                        }
                    }
                }
            }
        }