public WeatherPage(WeatherModal weather) { InitializeComponent(); if (weather != null) { txtLocation.Text = weather.Title; txtTemperature.Text = weather.Temperature; txtWind.Text = weather.Wind; txtHumidity.Text = weather.Humidity; txtSunrise.Text = weather.Sunrise; txtSunset.Text = weather.Sunset; longitute = weather.longitute; latitude = weather.latitude; var position = new Position(latitude, longitute); // Latitude, Longitude MyMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude), Distance.FromMiles(1))); var pin = new Pin { Type = PinType.Place, Position = position, Label = "custom pin", Address = "custom detail info" }; MyMap.Pins.Add(pin); } }
async void btnGetWeather_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(entPinCode.Text)) { weather = await GetWeather(entPinCode.Text); if (weather != null) { await Navigation.PushAsync(new WeatherPage(weather)); } else { string message = "Unable to get weather Details."; await DisplayAlert("Location", message, "OK"); } } }