I need the others code lines wait the getUserLocal finish its job and return the value to they run, mainly the InitializeComponent();. I used wait but it seems doesn't work and when the components are initialized, I haven't had the getUserLocal result yet...
this is the constructor of my view
public ComoChegarView(double lat, double longi)
{
userLocal = new Localizacao();
getUserLocal();
Localizacao lojaLocal = new Localizacao();
lojaLocal.latitude = lat;
lojaLocal.longitude = longi;
InitializeComponent();
}
This is the async task
async Task getUserLocal()
{
userLocal = await Geolocator.GetUserLocationAsync();
}
Does someone know how I can do that?