I have a problem with race conditions with winforms.
listViewCollections.ItemChecked += foo //Somewhere
void foo(object sender, ItemCheckedEventArgs e)
{
if (e.Item.Checked == false) return;
bool flag = bar( e.Item.Index);
if (flag) {
MessageBox.Show( ... )
e.Item.Checked = false;
}
}
Sometimes the message box shows twice. What's the correct way to do this? Thanks in advance!