private async void Button_Click(object sender, RoutedEventArgs e) { // recupera la localización del sistema operativo //var permiso = await Geolocator.RequestAccessAsync(); //if (permiso != GeolocationAccessStatus.Allowed) //{ // throw new Exception(); //} //var geolocator = new Geolocator { DesiredAccuracyInMeters = 0 }; //var position = await geolocator.GetGeopositionAsync(); IpStackProxy misCoordenadas = await IpStackProxy.RecuperaCoordenadas(); //OpenWeatherProxy miTiempo = await OpenWeatherProxy.RecuperaTiempo(position.Coordinate.Point.Position.Latitude, position.Coordinate.Point.Position.Longitude); OpenWeatherProxy miTiempo = await OpenWeatherProxy.RecuperaTiempo(misCoordenadas.Latitude, misCoordenadas.Longitude); //OpenWeatherProxy miTiempo = await OpenWeatherProxy.RecuperaTiempo(0.0, 0.0); tbInfo.Text = "- " + miTiempo.Name + "\n- " + miTiempo.Main.Temp + "ºC\n- " + miTiempo.Weather[0].Description; // string iconoUrl = "http://openweathermap.org/img/w/" + miTiempo.Weather[0].Icon + ".png"; string iconoUrl = "ms-appx:///Assets/Weather/" + miTiempo.Weather[0].Icon + ".png"; Icono.Source = new BitmapImage(new Uri(iconoUrl, UriKind.Absolute)); }
public static string ToJson(this OpenWeatherProxy self) => JsonConvert.SerializeObject(self, ET22_OpenWeather.Converter.Settings);