My problem is:
The user can search an address. If there was nothing found, the user sees an messagebox. He can close it by pressing ENTER. So far, so good. Calling SearchAddresses() can also be started by hitting ENTER. And now the user is in an endless loop because every ENTER (to let the messagebox disappear) starts an new search.
Here the codebehind:
private void TxtBoxAddress_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
btnSearch_Click(sender, e);
}
private void queryTask_Failed(object sender, TaskFailedEventArgs e)
{
//throw new NotImplementedException();
MessageBox.Show("*", "*", MessageBoxButton.OK);
isMapNearZoomed = false;
}
And here the xaml code:
<TextBox Background="Transparent" Name="TxtBoxAddress" Width="200" Text="" KeyUp="TxtBoxAddress_KeyUp"></TextBox>
<Button Content="Suchen" Name="btnSearch" Click="btnSearch_Click" Width="100"></Button>
How can I handle this endless loop in C#?