public MapPageCS() { CustomMap customMap = new CustomMap { MapType = MapType.Street }; CustomPin pin = new CustomPin { Type = PinType.Place, Position = new Position(37.79752, -122.40183), Label = "Xamarin San Francisco Office", Address = "394 Pacific Ave, San Francisco CA", Name = "Xamarin", Url = "http://xamarin.com/about/" }; customMap.CustomPins = new List <CustomPin> { pin }; customMap.Pins.Add(pin); customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(37.79752, -122.40183), Distance.FromMiles(1.0))); Content = customMap; }
private async void OnButton(object sender, EventArgs e) { CustomPin pin = new CustomPin { Type = PinType.SavedPin, Position = new Position(Convert.ToDouble(szerokosc.Text), Convert.ToDouble(dlugosc.Text)), Label = nazwaEntry.Text, Address = opisEntry.Text, Name = "Xamarin", Url = "http://xamarin.com/about/" }; pin.MarkerClicked += async(s, args) => { args.HideInfoWindow = true; string pinName = ((Pin)s).Label; string pytanie = ((Pin)s).Address; await DisplayAlert("Pin Clicked", $"{pinName} was clicked.", "Ok"); string result = await DisplayPromptAsync("Zagadka", $"{pytanie}", initialValue : "10", maxLength : 2, keyboard : Keyboard.Numeric); }; customMap.CustomPins = new List <CustomPin> { pin }; customMap.Pins.Add(pin); var json = JsonConvert.SerializeObject(new { X = pin.Position.Latitude, Y = pin.Position.Longitude }); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpClient client = new HttpClient(); var result = await client.PostAsync("http://dearjean.ddns.net:44201/api/Points", content); if (result.StatusCode == HttpStatusCode.Created) { await DisplayAlert("Komunikat", "Dodanie puntku przebiegło pomyślnie", "Anuluj"); } }