Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationManager.RequestWhenInUseAuthorization();

            // set map type and show user location
            map.MapType           = MKMapType.Standard;
            map.ShowsUserLocation = true;

            map.Bounds = View.Bounds;

            // set map center and region
            const double lat       = 42.374260;
            const double lon       = -71.120824;
            var          mapCenter = new CLLocationCoordinate2D(lat, lon);
            var          mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 2000, 2000);

            //map.CenterCoordinate = mapCenter;
            //map.Region = mapRegion;

            // add an annotation
            map.AddAnnotation(new MKPointAnnotation {
                Title      = "MyAnnotation",
                Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824)
            });

            // set the map delegate
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;

            // add a custom annotation
            map.AddAnnotation(new MonkeyAnnotation("Xamarin", mapCenter));

            // add an overlay
            var circleOverlay = MKCircle.Circle(mapCenter, 1000);

            map.AddOverlay(circleOverlay);

            var searchResultsController = new SearchResultsViewController(map);


            var searchUpdater = new SearchResultsUpdator();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            //add the search controller
            searchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };

            searchController.SearchBar.SizeToFit();
            searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
            searchController.SearchBar.Placeholder    = "Enter a search query";

            searchController.HidesNavigationBarDuringPresentation = false;
            NavigationItem.TitleView   = searchController.SearchBar;
            DefinesPresentationContext = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // change map type and show user location
            map.MapType           = MKMapType.Hybrid;
            map.ShowsUserLocation = true;

            // set map center and region
            double lat       = 42.374260;
            double lon       = -71.120824;
            var    mapCenter = new CLLocationCoordinate2D(lat, lon);
            var    mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 2000, 2000);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;

            // add an annotation
            map.AddAnnotation(new MKPointAnnotation()
            {
                Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824)
            });

            // set the map delegate
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;

            // add a custom annotation
            map.AddAnnotation(new MonkeyAnnotation("Xamarin", mapCenter));

            // add an overlay
            var circleOverlay = MKCircle.Circle(mapCenter, 1000);

            map.AddOverlay(circleOverlay);
        }
Exemplo n.º 3
0
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            // change map type and show user location
            map.MapType = MKMapType.Hybrid;
            map.ShowsUserLocation = true;

            // set map center and region
            double lat = 42.374260;
            double lon = -71.120824;
            var mapCenter = new CLLocationCoordinate2D (lat, lon);
            var mapRegion = MKCoordinateRegion.FromDistance (mapCenter, 2000, 2000);
            map.CenterCoordinate = mapCenter;
            map.Region = mapRegion;

            // add an annotation
            map.AddAnnotation (new MKPointAnnotation (){Title="MyAnnotation", Coordinate = new CLLocationCoordinate2D (42.364260, -71.120824)});

            // set the map delegate
            mapDel = new MyMapDelegate ();
            map.Delegate = mapDel;

            // add a custom annotation
            map.AddAnnotation (new MonkeyAnnotation ("Xamarin", mapCenter));

            // add an overlay
            var circleOverlay = MKCircle.Circle (mapCenter, 1000);
            map.AddOverlay (circleOverlay);
        }
Exemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            this.Title = Translations.Bl_Map;

            locationManager.RequestWhenInUseAuthorization();

            // set map type and show user location
            map.MapType = MKMapType.Standard;
            //map.ShowsUserLocation = true;
            map.Bounds = View.Bounds;

            // set map center and region
            //const double lat = 52.132633;
            //const double lon = 5.2912659999999505;


            double lat = Convert.ToDouble(Constants.Latitude);             //52.132633;
            double lon = Convert.ToDouble(Constants.Longitude);            //.2912659999999505;

            // set the map delegate
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;


            foreach (Branch aBranch in this._branchList)
            {
                lat = Convert.ToDouble(aBranch.Latitude);
                lon = Convert.ToDouble(aBranch.Longitude);

                // add an annotation
                map.AddAnnotation(new MKPointAnnotation
                {
                    Title      = aBranch.BranchName,
                    Coordinate = new CLLocationCoordinate2D(Convert.ToDouble(aBranch.Latitude), Convert.ToDouble(aBranch.Longitude))
                });
            }

            var mapCenter = new CLLocationCoordinate2D(lat, lon);
            var mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 200000, 200000);

            map.CenterCoordinate = mapCenter;

            //map.Region = mapRegion;
            //[myMapView setRegion:adjustedRegion animated:YES];

            map.SetRegion(mapRegion, true);

            //add an overlay
            //var circleOverlay = MKCircle.Circle(mapCenter, 5000);
            //map.AddOverlay(circleOverlay);
        }
Exemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationManager.RequestWhenInUseAuthorization();
            View.UserInteractionEnabled = true;
            LocationContainer.Hidden    = locsHide;

            // Create Map
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;

            map.MapType           = MKMapType.Standard;
            map.ShowsUserLocation = true;

            View = map;
            View.AddSubview(SearchView);
            View.AddSubview(LocationContainer);


            // set map center and region
            const double lat       = 43.161030;
            const double lon       = -77.610924;
            var          mapCenter = new CLLocationCoordinate2D(lat, lon);
            var          mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 20000, 20000);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;


            //Create Serach Bar
            searchResultsController = new SearchResultsViewController(map);
            var searchUpdater = new SearchResultsUpdator();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            //add the search controller
            searchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };


            SearchView.AddSubview(searchController.SearchBar);
            SearchView.BackgroundColor = new UIColor(255, 255, 255, (System.nfloat) .20);

            searchController.SearchBar.SizeToFit();
            searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
            searchController.SearchBar.Placeholder    = "Find Locations You Want To Save";

            searchController.HidesNavigationBarDuringPresentation = false;


            DefinesPresentationContext = true;
        }
Exemplo n.º 6
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			locationManager.RequestWhenInUseAuthorization ();

			// set map type and show user location
			map.MapType = MKMapType.Standard;
			map.ShowsUserLocation = true;
			map.Bounds = View.Bounds;

			// set map center and region
			const double lat = 42.374260;
			const double lon = -71.120824;
			var mapCenter = new CLLocationCoordinate2D (lat, lon);
			var mapRegion = MKCoordinateRegion.FromDistance (mapCenter, 2000, 2000);
			map.CenterCoordinate = mapCenter;
			map.Region = mapRegion;

			// add an annotation
			map.AddAnnotation (new MKPointAnnotation {
				Title = "MyAnnotation", 
				Coordinate = new CLLocationCoordinate2D (42.364260, -71.120824)
			});

			// set the map delegate
			mapDel = new MyMapDelegate ();
			map.Delegate = mapDel;

			// add a custom annotation
			map.AddAnnotation (new MonkeyAnnotation ("Xamarin", mapCenter));

			// add an overlay
			var circleOverlay = MKCircle.Circle (mapCenter, 1000);
			map.AddOverlay (circleOverlay);

			var searchResultsController = new SearchResultsViewController (map);


			var searchUpdater = new SearchResultsUpdator ();
			searchUpdater.UpdateSearchResults += searchResultsController.Search;

			//add the search controller
			searchController = new UISearchController (searchResultsController) {
				SearchResultsUpdater = searchUpdater
			};

			searchController.SearchBar.SizeToFit ();
			searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
			searchController.SearchBar.Placeholder = "Enter a search query";

			searchController.HidesNavigationBarDuringPresentation = false;
			NavigationItem.TitleView = searchController.SearchBar;
			DefinesPresentationContext = true;
		}
Exemplo n.º 7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationManager.RequestWhenInUseAuthorization();
            // set map type and show user location
            map.MapType           = MKMapType.Standard;
            map.ShowsUserLocation = true;
            map.Bounds            = View.Bounds;
            // set map center and region
            double lat       = 42.374260;
            double lon       = -71.120824;
            var    mapCenter = new CLLocationCoordinate2D(lat, lon);
            var    mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 2000, 2000);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;

            // add an annotation
            map.AddAnnotation(new MKPointAnnotation()
            {
                Title      = "MyAnnotation",
                Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824)
            });

            // set the map delegate
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;

            // add a custom annotation
            map.AddAnnotation(new MonkeyAnnotation("Xamarin", mapCenter));

            // add an overlay
            var circleOverlay = MKCircle.Circle(mapCenter, 1000);

            map.AddOverlay(circleOverlay);

            // create search controller
            searchBar = new UISearchBar(new CGRect(0, 20, View.Frame.Width, 50))
            {
                Placeholder = "Enter a search query"
            };

            searchController                     = new UISearchDisplayController(searchBar, this);
            searchController.Delegate            = new SearchDelegate(map);
            searchController.SearchResultsSource = new SearchSource(searchController, map);
            View.AddSubview(searchBar);
        }
Exemplo n.º 8
0
        private void PrepareMap(StudentLocationModel slm)
        {
            try
            {
                if (mapview.Annotations != null)
                {
                    mapview.RemoveAnnotations(mapview.Annotations);
                }
                //foreach (var item in mapview.Annotations)
                //{
                //	mapview.RemoveAnnotation(item);
                //}
                mapview.SetNeedsDisplay();

                CLLocationCoordinate2D coordsforStudent = new CLLocationCoordinate2D(slm.student_lat, slm.student_lng);
                MKCoordinateSpan       span1            = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coordsforStudent.Latitude));
                mapview.Region = new MKCoordinateRegion(coordsforStudent, span1);


                CLLocationCoordinate2D coordsforSource = new CLLocationCoordinate2D(slm.source_lat, slm.source_lng);
                MKCoordinateSpan       span2           = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coordsforSource.Latitude));
                mapview.Region = new MKCoordinateRegion(coordsforSource, span2);


                CLLocationCoordinate2D coordsfordestinatin = new CLLocationCoordinate2D(slm.destination_lat, slm.destination_lng);
                MKCoordinateSpan       span3 = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coordsfordestinatin.Latitude));
                mapview.Region = new MKCoordinateRegion(coordsfordestinatin, span3);


                // set the map delegate
                mapDel           = new MyMapDelegate();
                mapview.Delegate = mapDel;

                // add a custom annotation
                mapview.AddAnnotation(new CustomAnnotation(0, StaticDataModel.StudentInfo + "'s Home", coordsforStudent));
                mapview.AddAnnotation(new CustomAnnotation(1, "Source", coordsforSource));
                mapview.AddAnnotation(new CustomAnnotation(2, "Destination", coordsfordestinatin));

                //// add a custom annotationTesting prupose
                //CLLocationCoordinate2D coords1 = new CLLocationCoordinate2D(StaticDataModel.Lattitude, StaticDataModel.Longitude);
                //mapview.AddAnnotation(new CustomAnnotation("Bus",coords1));
            }
            catch (Exception ex)
            {
            }
        }
   protected override void OnElementChanged (ElementChangedEventArgs<MyMap> e)
   {
     base.OnElementChanged (e);
     var map = e.NewElement; // Remember to check for null
     var locations = map.Locations;
     // Do what you want with locations
 
     var cmd = Map.PinTapped; // Send this along to MyMapDelegate
     var nativeMap = new MKMapView(); // Initiate with relevant parameters
     SetNativeControl(nativeMap)
     MyMapDelegate myMapDelegate = new MyMapDelegate (cmd); // Change constructor here
     nativeMap.Delegate = myMapDelegate;
     nativeMap.AddAnnotation(new MKPointAnnotation (){
         Title=list[0].nome,
         Coordinate = new CLLocationCoordinate2D (42.364260, -71.120824)
     });
   }
Exemplo n.º 10
0
        private void PrepareMap(double lat, double lng)
        {
            try
            {
                CLLocationCoordinate2D coordsfordestinatin = new CLLocationCoordinate2D(lat, lng);
                MKCoordinateSpan       span3 = new MKCoordinateSpan(StudentTracking.MilesToLatitudeDegrees(2), StudentTracking.MilesToLongitudeDegrees(2, coordsfordestinatin.Latitude));
                mapview.Region = new MKCoordinateRegion(coordsfordestinatin, span3);

                // set the map delegate
                var mapDel = new MyMapDelegate();
                mapview.Delegate = mapDel;
                // add a custom annotation
                mapview.AddAnnotation(new CustomAnnotation(0, StaticDataModel.StudentInfo + "'student location", coordsfordestinatin));
            }
            catch (Exception ex)
            {
            }
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			locationManager.RequestWhenInUseAuthorization ();
			// set map type and show user location
			map.MapType = MKMapType.Standard;
			map.ShowsUserLocation = true;
			map.Bounds = View.Bounds;
			// set map center and region
			double lat = 42.374260;
			double lon = -71.120824;
			var mapCenter = new CLLocationCoordinate2D (lat, lon);
			var mapRegion = MKCoordinateRegion.FromDistance (mapCenter, 2000, 2000);
			map.CenterCoordinate = mapCenter;
			map.Region = mapRegion;

			// add an annotation
			map.AddAnnotation (new MKPointAnnotation () {
				Title = "MyAnnotation", 
				Coordinate = new CLLocationCoordinate2D (42.364260, -71.120824)
			});

			// set the map delegate
			mapDel = new MyMapDelegate ();
			map.Delegate = mapDel;

			// add a custom annotation
			map.AddAnnotation (new MonkeyAnnotation ("Xamarin", mapCenter));

			// add an overlay
			var circleOverlay = MKCircle.Circle (mapCenter, 1000);
			map.AddOverlay (circleOverlay);

			// create search controller
			searchBar = new UISearchBar (new CGRect (0, 20, View.Frame.Width, 50)) {
				Placeholder = "Enter a search query"
			};

			searchController = new UISearchDisplayController (searchBar, this);
			searchController.Delegate = new SearchDelegate (map);
			searchController.SearchResultsSource = new SearchSource (searchController, map);
			View.AddSubview (searchBar);
		}
Exemplo n.º 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            locationManager.RequestWhenInUseAuthorization();

            // set map type and show user location
            map.MapType           = MKMapType.Standard;
            map.ShowsUserLocation = true;
            map.Bounds            = View.Bounds;

            // set map center and region
            double lat       = 31.739444;
            double lon       = -106.48694;
            var    mapCenter = new CLLocationCoordinate2D(lat, lon);
            var    mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 3000, 3000);

            map.CenterCoordinate = mapCenter;
            map.Region           = mapRegion;

            // add an annotation
            var actualAnnotation = new MKPointAnnotation();

            actualAnnotation.Title      = "Ubicacion Actual";
            actualAnnotation.Coordinate = new CLLocationCoordinate2D(lat, lon);
            map.AddAnnotation(actualAnnotation);

            // set the map delegate
            mapDel       = new MyMapDelegate();
            map.Delegate = mapDel;


            // add an overlay
            var circleOverlay = MKCircle.Circle(mapCenter, 200);

            map.AddOverlay(circleOverlay);

            // Safe Zone
            var mapSafe        = new CLLocationCoordinate2D(31.75, -106.5);
            var safeOverlay_01 = MKCircle.Circle(mapSafe, 20);

            map.AddOverlay(safeOverlay_01);
            //map.AddAnnotation(new MonkeyAnnotation("Xamarin", mapCenter));
            var punto = new MKPointAnnotation();

            punto.Title      = "Startbucks";
            punto.Coordinate = new CLLocationCoordinate2D(31.75, -106.5);
            map.AddAnnotation(punto);

            // Danger Zone
            var mapDanger        = new CLLocationCoordinate2D(31.7526, -106.5053);
            var dangerOverlay_01 = MKCircle.Circle(mapDanger, 400);

            map.AddOverlay(dangerOverlay_01);


            // Busqueda
            var searchResultsController = new SearchResultsViewController(map);

            var searchUpdater = new SearchResultsUpdator();

            searchUpdater.UpdateSearchResults += searchResultsController.Search;

            //add the search controller
            searchController = new UISearchController(searchResultsController)
            {
                SearchResultsUpdater = searchUpdater
            };

            searchController.SearchBar.SizeToFit();
            searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
            searchController.SearchBar.Placeholder    = "Enter a search query";

            searchController.HidesNavigationBarDuringPresentation = false;
            NavigationItem.TitleView   = searchController.SearchBar;
            DefinesPresentationContext = true;

            /* Button Actions */
            upButton.TouchUpInside += (object sender, EventArgs e) => {
                map.RemoveAnnotation(actualAnnotation);
                map.RemoveOverlay(circleOverlay);

                lat = lat + 0.0005;
                actualAnnotation.Title      = "Ubicacion Actual";
                actualAnnotation.Coordinate = new CLLocationCoordinate2D(lat, lon);
                map.AddAnnotation(actualAnnotation);

                mapCenter     = new CLLocationCoordinate2D(lat, lon);
                circleOverlay = MKCircle.Circle(mapCenter, 200);
                map.AddOverlay(circleOverlay);

                check(lon, lat);
            };

            leftButton.TouchUpInside += (object sender, EventArgs e) => {
                map.RemoveAnnotation(actualAnnotation);
                map.RemoveOverlay(circleOverlay);

                lon = lon - 0.0005;
                actualAnnotation.Title      = "Ubicacion Actual";
                actualAnnotation.Coordinate = new CLLocationCoordinate2D(lat, lon);
                map.AddAnnotation(actualAnnotation);

                mapCenter     = new CLLocationCoordinate2D(lat, lon);
                circleOverlay = MKCircle.Circle(mapCenter, 200);
                map.AddOverlay(circleOverlay);

                check(lon, lat);
            };

            rightButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                map.RemoveAnnotation(actualAnnotation);
                map.RemoveOverlay(circleOverlay);

                lon = lon + 0.0005;
                actualAnnotation.Title      = "Ubicacion Actual";
                actualAnnotation.Coordinate = new CLLocationCoordinate2D(lat, lon);
                map.AddAnnotation(actualAnnotation);

                mapCenter     = new CLLocationCoordinate2D(lat, lon);
                circleOverlay = MKCircle.Circle(mapCenter, 200);
                map.AddOverlay(circleOverlay);

                check(lon, lat);
            };

            downButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                map.RemoveAnnotation(actualAnnotation);
                map.RemoveOverlay(circleOverlay);

                lat = lat - 0.0005;
                actualAnnotation.Title      = "Ubicacion Actual";
                actualAnnotation.Coordinate = new CLLocationCoordinate2D(lat, lon);
                map.AddAnnotation(actualAnnotation);

                mapCenter     = new CLLocationCoordinate2D(lat, lon);
                circleOverlay = MKCircle.Circle(mapCenter, 200);
                map.AddOverlay(circleOverlay);

                check(lon, lat);
            };
        }
Exemplo n.º 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //If no historyitem is selected
            var mainVM = this.ViewModel as MainViewModel; //To get the item from the ViewModel, Get it via the VM itself, and cast it as that type of VM.

            if (mainVM != null)
            {
                selectedHistoryItem = mainVM.SelectedHistoryItem;
            }

            //If you haven't selected an item,  show the History/... bottom bars + search bar
            if (selectedHistoryItem == null)
            {
                //Bottom Tab bar
                UIBarButtonItem recentHistoryBarButton = new UIBarButtonItem(UIBarButtonSystemItem.Rewind);
                recentHistoryBarButton.Title = "Recent History";
                UIBarButtonItem[] toolbarItems = new UIBarButtonItem[] {
                    recentHistoryBarButton//,
                    //...
                };

                this.SetToolbarItems(toolbarItems, false);
                this.NavigationController.ToolbarHidden = false;

                /////////////
                // BINDING //
                MvxFluentBindingDescriptionSet <MainView, MainViewModel> set = new MvxFluentBindingDescriptionSet <MainView, MainViewModel>(this);
                set.Bind(recentHistoryBarButton).To(vm => vm.SearchHistoryCommand); //show Search History window

                set.Apply();
            }


            ////////////
            // MapKit //
            locationManager.RequestWhenInUseAuthorization(); //Request authorisation to use location when app is in foreground. (Error in versions below 8.0)
            //Type
            MainMap.MapType = MapKit.MKMapType.Standard;
            //Panning and Zooming
            MainMap.ZoomEnabled   = true;
            MainMap.ScrollEnabled = true;
            //User Location
            MainMap.ShowsUserLocation = true;

            // set map center and region
            const double lat       = 50.8247952; //Stationsplein kortrijk
            const double lon       = 3.2643516000000545;
            var          mapCenter = new CLLocationCoordinate2D(lat, lon);
            var          mapRegion = MKCoordinateRegion.FromDistance(mapCenter /*MainMap.UserLocation.Coordinate*/, 2000, 2000);

            //MainMap.CenterCoordinate = mapCenter/*MainMap.UserLocation.Coordinate*/;
            MainMap.Region = mapRegion;


            if (selectedHistoryItem != null)
            {
                CLLocationCoordinate2D coordinate2D = new CLLocationCoordinate2D(double.Parse(selectedHistoryItem.Latitude), double.Parse(selectedHistoryItem.Longitude));
                //Adding an annotation
                MainMap.AddAnnotations(new MKPointAnnotation()
                {
                    Title      = selectedHistoryItem.Name,
                    Coordinate = coordinate2D,
                    Subtitle   = selectedHistoryItem.LatLong
                });
                MainMap.SetCenterCoordinate(coordinate2D, true);
                MainMap.Region = MKCoordinateRegion.FromDistance(coordinate2D, 10000, 10000);
            }


            // set the map delegate
            mapDelegate      = new MyMapDelegate();
            MainMap.Delegate = mapDelegate;


            ////////////
            //Local Search UIBar
            if (selectedHistoryItem == null)
            {
                var searchResultsController = new SearchResultsView(MainMap, mainVM); //Also give the Viewmodel, so we can access it for the Messenger/Posting

                var searchUpdater = new SearchResultsUpdater();
                searchUpdater.UpdateSearchResults += searchResultsController.Search;

                //add the search controller
                searchController = new UISearchController(searchResultsController)
                {
                    SearchResultsUpdater = searchUpdater
                };

                searchController.SearchBar.SizeToFit();
                searchController.SearchBar.SearchBarStyle = UISearchBarStyle.Minimal;
                searchController.SearchBar.Placeholder    = "Enter a search query";

                searchController.HidesNavigationBarDuringPresentation = false;
                NavigationItem.TitleView   = searchController.SearchBar;
                DefinesPresentationContext = true;
            }

            //Compass
            var compass = MKCompassButton.FromMapView(MainMap);

            compass.CompassVisibility         = MKFeatureVisibility.Visible;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(compass);
            MainMap.ShowsCompass = false; // so we don't have two compasses!
            // User tracking button
            //Because of using it on a simulator, you can't actually SEE it, but it does work. probably.
            var button = MKUserTrackingButton.FromMapView(MainMap);

            button.Layer.BackgroundColor = UIColor.FromRGBA(255, 255, 255, 80).CGColor;
            button.Layer.BorderColor     = UIColor.White.CGColor;
            button.Layer.BorderWidth     = 1;
            button.Layer.CornerRadius    = 5;
            button.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(button);
        }