private void RemovePin(object o) { if (Pins.Count == 0) { return; } var pin = Pins.LastOrDefault(); _allPins.AddLast(pin); Pins.Remove(pin); _removePinCommand.ChangeCanExecute(); _addPinCommand.ChangeCanExecute(); _selectCommand.ChangeCanExecute(); }
private async Task OnLongclickedCommand(Position point) { var lat = point.Latitude; var lng = point.Longitude; var pin = Pins.LastOrDefault(x => x.Position == point); if (pin == null) { PromptResult result = await UserDialogs.Instance.PromptAsync(string.Format("{0}, {1}", lat, lng), AppResources.DoYouWantToAddNewPin, AppResources.OK, AppResources.Cancel, AppResources.Name); if (result.Ok) { Pins.Add(new Pin() { Position = new Position(lat, lng), Type = PinType.SavedPin, Label = result.Text, Tag = string.Empty }); await _pinService.SaveOrUpdatePinAsync(Pins.Last().ToPinModel()); } } }