I can not leave a% void% empty when I click on SearchBar
, I have to force the user to fill it. Here is the code:
//Pesquisa a cidade quando o botão de Pesquisa do teclado é clicado
private async void MainSearchBar_OnSearchButtonPressed(object sender, EventArgs e)
{
{
await Task.Factory.StartNew(() => //Task, classe que facilita o uso de Threads(processamento paralelo).
{
IsLoading = true;
NotifyPropertyChanged("Loading");
string cidade;
cidade = MainSearchBar.Text;
BeginInvokeOnMainThreadAsync(() => //conseguirmos fazer a thread ser executada dentro da Thread Principal responsável pela UI
{
AtualizaDados();
}).GetAwaiter().GetResult();
IsLoading = false;
NotifyPropertyChanged("Loading");
});
}
}
I'm trying to put the following code so that it can work (but is not giving rs):
/*Se tiver vazio...
if (MainSearchBar.Text == null)
{
await DisplayAlert("Comunicado", "Campo de pesquisa vazio", "OK");
}
else*/
It gives the impression that buscar
has some function that by clicking SearchBar
and it is empty it simply does nothing.