I'm developing a project and to avoid creating screens with similar functions, I've created a generic query display screen. Basically, the user chooses a brand and sets it to the screen with a listview that shows all the brands available, so he chooses a brand, back to the previous screen, where he will choose a template and so on. My difficulty is to load the data, I would like the application to wait for the search to finish before opening the screen as a result, normally the screen opens before the query finishes processing, then the screen comes blank, if the user returns and enters new, the data is there ..
private async Task ProcessaPesquisa()
{
var resultpesq = await ApiAnuncios.OpcoesPesquisa.GetAsync();
Resultpesq = new ObservableCollection<Model.ModelLista>(resultpesq);
MainPage.PckListaPesq = new ListView();
MainPage.PckListaPesq.ItemsSource = Resultpesq;
}
When I call this routine, I do this:
await ProcessaPesquisa();
// aqui eu chamo a tela que vai mostrar o resultado
App.NavigationMsterDetail(new Views.ViewOpcoes());
The problem is that it does not wait. Any suggestions?