I have ListView
with a function so that every 30 seconds ListView
is updated.
When clicked on above an item from my ListView
another screen at that time is called and unfortunately the ListView
screen still keeps updating every 30 seconds, I would like that at that time this 30 in 30 seconds it stopped. I could solve this with an'if ', but for this I need to know when ItemTapped
was triggered, which I do not know how to implement.
My ListView:
<!-- Listagem de Produtos -->
<ListView x:Name="lstLeilao"
ItemTapped="OnTapLance">
<ListView.ItemTemplate>
<!-- DataTemplate = exibe dados de uma coleção de objetos em um ListView -->
<DataTemplate>
<ViewCell>
...
<!-- Grid de exibição -->
...
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The function that counts 30 seconds:
//A cada 30 segundos atualiza a tela Leilão Aberto
public void TempoAtualiza()
{
Device.StartTimer ( TimeSpan.FromSeconds(30), () =>
{
if (OnTapLance == true) //AQUI QUE EU IMPLEMENTARIA A FUNÇÃO
return false;
AtualizaDados(usuario);
return true;
});
}
The click function:
//Toque
public void OnTapLance(object sender, ItemTappedEventArgs e)
{
isLoading = true;
var item = (sender as ListView).SelectedItem as LeilaoObjeto;
Navigation.PushAsync(new Lance(Convert.ToInt32(item.ID_LEILAO)));
isLoading = false;
}