//Adds the first pin to the map and pans to that pins location private async void AddPinOnLoad() { await MapUtils.RetrieveLocation(); lat = MapUtils.getLat(); lng = MapUtils.getLng(); var customPin = new CustomPin { Type = PinType.Place, Position = new Position(lat, lng), Label = "My Position!", Id = "myPin", Url = "homepages.uc.edu/~ringjy" }; //Add pin to map customMap.Pins.Clear(); customMap.Pins.Add(customPin); updateGroupPins(); NetworkUtils.updateCoords(lat, lng); //Center map on user/pin location customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(lat, lng), Distance.FromMiles(0.1))); }
//Add the group member pins to map private void updateGroupPins() { List <String> userNames = NetworkUtils.getUsers(); for (int i = 0; i < NetworkUtils.userLats.Count; i++) { //Create map pin var customPin = new CustomPin { Type = PinType.Place, Position = new Position(NetworkUtils.userLats[i], NetworkUtils.userLngs[i]), Label = userNames[i], }; customMap.Pins.Add(customPin); } }
//Method that runs every 3 seconds and updates the users pin location - prevents panning to that location every 3s private async void AddPinsToMap() { await MapUtils.RetrieveLocation(); lat = MapUtils.getLat(); lng = MapUtils.getLng(); var customPin = new CustomPin { Type = PinType.Place, Position = new Position(lat, lng), Label = "My Position!", Id = "myPin", Url = "homepages.uc.edu/~ringjy" }; //Add pin to map customMap.Pins.Clear(); customMap.Pins.Add(customPin); }
//Add pins to map private async void AddPinsToMap() { await MapUtils.RetrieveLocation(); lat = MapUtils.getLat(); lng = MapUtils.getLng(); //Create map pin var customPin = new CustomPin { Type = PinType.Place, Position = new Position(lat, lng), Label = "My Position!", Id = "Xamarin", Url = "homepages.uc.edu/~ringjy" }; //Add pin to map customMap.Pins.Clear(); customMap.Pins.Add(customPin); updateGroupPins(); NetworkUtils.updateCoords(lat, lng); }