Exemplo n.º 1
0
        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());
                }
            }
        }