private void btnDelete_Click(object sender, RoutedEventArgs e) { if (lstParticipants.SelectedIndex == -1) return; RegistrationHelper client = new RegistrationHelper(); try { client.DeleteParticipant(user, event_.EventID, (int)lstParticipants.SelectedValue); loadParticipants(); MessageBox.Show("Operation succeeded!"); lstParticipants_SelectionChanged(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { client.Close(); } }