Пример #1
0
        private void OnZoomToVenue(object sender, MvxValueEventArgs <Venue> e)
        {
            EndSearch();

            var annotation = GetAnnotationByVenue(ViewModel.SelectedVenueOnMap);

            var shiftedCoord = annotation.Coordinate;

            shiftedCoord.Latitude += 0.0008f;

            VenuesMapView.SetRegion(
                MapUtil.CoordinateRegionForCoordinates(shiftedCoord), true);
        }
Пример #2
0
        private void DisposeMapView()
        {
            VenuesMapView.RemoveAnnotations(VenuesMapView.Annotations);

            var mapDelegate = VenuesMapView.WeakDelegate as MapDelegate;

            if (mapDelegate != null)
            {
                mapDelegate.SelectAnnotationCommand = null;
                mapDelegate.ShowDetailsCommand      = null;
                mapDelegate.Dispose();
                VenuesMapView.WeakDelegate = null;
            }
        }
Пример #3
0
        private void InitializeStyle()
        {
            MapFullscreenButton.SemiTransparentType = SemiTransparentType.Light;
            MapFullscreenButton.UpdateState();

            VenuesMapView.TintColor = ThemeColors.Metadata;
            VenuesMapView.FixLegalLabel();

            SearchBar.Placeholder    = Localization.Search;
            SearchBar.TintColor      = ThemeColors.ContentLightText;
            SearchBar.BarTintColor   = null;
            SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
            SearchBar.SetPassiveStyle();
        }
Пример #4
0
        private void InitializeMapView()
        {
            if (ViewModel.OrgEvent != null &&
                ViewModel.OrgEvent.Venues != null)
            {
                if (!_isMapViewInitialized)
                {
                    VenuesMapView.RemoveAnnotations(VenuesMapView.Annotations);

                    if (!(VenuesMapView.WeakDelegate is MapDelegate))
                    {
                        var mapDelegate = new MapDelegate
                        {
                            SelectAnnotationCommand = ViewModel.SelectVenueOnMapCommand,
                            ShowDetailsCommand      = ViewModel.NavigateVenueCommand
                        };
                        VenuesMapView.Delegate = mapDelegate;
                    }

                    var annotations = ViewModel.OrgEvent.Venues
                                      .SelectMany(v => v.Info.Addresses
                                                  .Select(a => new VenueAnnotation(v, a))).ToArray();
                    var coordinates = MapUtil.GetAnnotationsCoordinates(annotations);

                    VenuesMapView.SetRegion(MapUtil.CoordinateRegionForCoordinates(coordinates, MapMargin), false);
                    VenuesMapView.AddAnnotations(annotations);

                    if (ViewModel.SelectedVenueOnMap != null)
                    {
                        SelectVenueMapAnnotation(ViewModel.SelectedVenueOnMap);
                    }

                    _isMapViewInitialized = true;
                }
            }
            else
            {
                VenuesMapView.RemoveAnnotations(VenuesMapView.Annotations);
                _isMapViewInitialized = false;
            }
        }
Пример #5
0
        private void SelectVenueMapAnnotation(Venue venue)
        {
            if (venue != null)
            {
                var annotation = GetAnnotationByVenue(venue);
                if (annotation != null)
                {
                    VenuesMapView.SelectAnnotation(annotation, true);
                }
            }
            else if (VenuesMapView.SelectedAnnotations != null &&
                     VenuesMapView.SelectedAnnotations.Any())
            {
                foreach (var annotation in VenuesMapView.SelectedAnnotations)
                {
                    VenuesMapView.DeselectAnnotation(annotation, false);
                }

                var annotations = VenuesMapView.Annotations.OfType <VenueAnnotation>();
                var coordinates = MapUtil.GetAnnotationsCoordinates(annotations);
                VenuesMapView.SetRegion(MapUtil.CoordinateRegionForCoordinates(coordinates, MapMargin), true);
            }
        }