Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Load weather info at app startup

$
0
0

Hello I'm still begining with xamarin forms so I followed the Weather App example from https://developer.xamarin.com/samples/xamarin-forms/Weather/ I have it working on a different project the problem is that this one works with a Clicked event and I'd like that this weather data is shown on top of the app at my shell TitleView element don't care about being updated regularly or something just one call when you load the app.

The code for the clicked event is
async void OnGetWeatherButtonClicked(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(_cityEntry.Text))
{
WeatherData weatherData = await _restService.GetWeatherData(GenerateRequestUri(Constants.OpenWeatherMapEndpoint));
BindingContext = weatherData;
}
}

I changed that to be an async task and put that on App.xaml.cs file inside protected override void OnStart() but still the data is not loaded and read about app freezing if data fails to load, how can this be achieved, thanks


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>