Esempio n. 1
0
        private static void ShowLocation()
        {
            Window.Navigator.Geolocation.GetCurrentPosition(delegate(Geolocation location) {
                MapViewOptions viewOptions = new MapViewOptions();
                viewOptions.Center         = new MapLocation(location.Coordinates.Latitude,
                                                             location.Coordinates.Longitude);
                viewOptions.Zoom    = 10;
                viewOptions.Animate = true;

                _map.SetView(viewOptions);
                UpdatePhotos(/* newPhotos */ false);

                if (_currentPushpin == null)
                {
                    MapPushpinOptions pushpinOptions = new MapPushpinOptions();
                    pushpinOptions.Icon     = "Pushpin.png";
                    pushpinOptions.Anchor   = new MapPoint(12, 14);
                    pushpinOptions.Width    = 25;
                    pushpinOptions.Height   = 28;
                    pushpinOptions.TypeName = "currentPushpin";

                    _currentPushpin = new MapPushpin(viewOptions.Center, pushpinOptions);
                    _map.Entities.Push(_currentPushpin);
                }
                else
                {
                    _currentPushpin.SetLocation(viewOptions.Center);
                }
            });
        }
Esempio n. 2
0
        private static void ShowFavorites()
        {
            _model.ShowFavorites();

            int favoriteCount = _model.Photos.Count;

            if (favoriteCount != 0)
            {
                MapLocation[] locations = new MapLocation[favoriteCount];

                for (int i = 0; i < favoriteCount; i++)
                {
                    locations[i] = new MapLocation(_model.Photos[i].latitude, _model.Photos[i].longitude);
                }

                MapViewOptions viewOptions = new MapViewOptions();
                viewOptions.Bounds  = MapBounds.FromLocations(locations);
                viewOptions.Animate = true;

                _map.SetView(viewOptions);
                UpdatePhotos(/* newPhotos */ false);
            }
        }