Пример #1
0
        protected virtual void OnTap(MapTapEventArgs e)
        {
            var handler = Tapped;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        private async void MyMap_Tapped(object sender, MapTapEventArgs e)
        {
            if (pinFlag == false)
            {
                infoLabel.Text = "Adding starting point";
                pinFlag        = true;
                var latitude  = e.Position.Latitude;
                var longitude = e.Position.Longitude;

                var position = new Position(latitude, longitude);

                var pin = new Pin
                {
                    Type     = PinType.Place,
                    Position = position,
                    Label    = "Start",
                    Address  = "",
                };

                myMap.Pins.Add(pin);

                var saveButton = new ToolbarItem
                {
                    Name    = "Save",
                    Command = new Command(this.Save),
                };

                var cancelButton = new ToolbarItem
                {
                    Name    = "Cancel",
                    Command = new Command(this.Cancel),
                };

                this.ToolbarItems.Add(saveButton);
                this.ToolbarItems.Add(cancelButton);

                infoLabel.Text = "";
            }
        }