public override void LoadView() { base.LoadView(); _MapView = new MapView() { MyLocationEnabled = true, }; _Markers.ForEach(mmi => mmi.Map = _MapView); _MapView.Settings.RotateGestures = false; _MapView.Tapped += (object tapSender, GMSCoordEventArgs coordEventArgs) => { UIAlertView nameInputAlertView = new UIAlertView("Add New Marker", "", null, "Cancel", new[] { "Add" }) { AlertViewStyle = UIAlertViewStyle.PlainTextInput, }; UITextField nameTextField = nameInputAlertView.GetTextField(0); nameTextField.Placeholder = "Marker name"; nameTextField.BecomeFirstResponder(); nameInputAlertView.Dismissed += (sender, e) => { if (e.ButtonIndex != nameInputAlertView.CancelButtonIndex) { MarkerInfo newMarkerInfo = new MarkerInfo() { Latitude = coordEventArgs.Coordinate.Latitude, Longitude = coordEventArgs.Coordinate.Longitude, Name = nameTextField.Text, }; NewMarkerCreated(this, new MarkerAddedEventArgs(newMarkerInfo)); } }; nameInputAlertView.Show(); }; View = _MapView; }
public Task<int> SaveMarker(MarkerInfo item) { if (item.Id != 0) { return UpdateAsync(item); } else { return InsertAsync(item); } }
public Task <int> SaveMarker(MarkerInfo item) { if (item.Id != 0) { return(UpdateAsync(item)); } else { return(InsertAsync(item)); } }
public void RefreshMarkers() { _Database.GetAllMarkersAsync().ContinueWith(task => { InvokeOnMainThread(() => { List <MarkerInfo> markerData = task.Result.OrderBy(mi => mi.Name).ToList(); _MainSection.Clear(); _MainSection.AddAll(markerData.Select(markerInfo => { MarkerInfo currentMarkerInfo = markerInfo; StyledStringElement markerNameElement = new StyledStringElement(currentMarkerInfo.Name, () => { InvokeOnMainThread(() => { mapController.SetCameraPosition(currentMarkerInfo.Latitude, currentMarkerInfo.Longitude); NavigationController.PushViewController(mapController, animated: true); }); }); markerNameElement.Accessory = UITableViewCellAccessory.DisclosureIndicator; return(markerNameElement as Element); })); ReloadData(); mapController.RefreshMarkers(markerData); }); }); }
public MappedMarkerInfo(MarkerInfo markerInfo) { MarkerInfo = markerInfo; Position = new CLLocationCoordinate2D(MarkerInfo.Latitude, MarkerInfo.Longitude); Title = MarkerInfo.Name; }
public MarkerAddedEventArgs(MarkerInfo markerInfo) { MarkerInfo = markerInfo; }