async void OnButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(cityEntry.Text)) { WeatherData weatherData = await _restService.GetWeatherDataAsync(GenerateRequestUri(Constants.OpenWeatherMapEndpoint)); BindingContext = weatherData; } }
async void OnButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(cityEntry.Text)) { WeatherData weatherData = await _restService.GetWeatherDataAsync(GenerateRequestUri(Constants.OpenWeatherMapEndpoint)); BindingContext = weatherData; DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime DTsunrise = time.AddSeconds((double)Sys.Sunrise + weatherData.Timezone); DateTime DTsunset = time.AddSeconds((double)Sys.Sunset + weatherData.Timezone); sunrise.Text = DTsunrise.ToString(); sunset.Text = DTsunset.ToString(); } }