private void RemoveEvent_Click(object sender, EventArgs e) { EventsListBox.Invoke(new Action( () => { if (EventsListBox.SelectedItems.Count == 1) { Event selectedEvent = EventsListBox.SelectedItem as Event; selectedEvent.DeclinedUsers.Add(m_LoggedInUser); EventsListBox.SelectedItems.Remove(selectedEvent); } if (EventsListBox.SelectedItems.Count == 0) { MessageBox.Show("no event was picked"); } } ) ); }
private void fetchEvents() { if (checkIfUserLoggedIn()) { if (m_CurrentEvents.Count == 0) { MessageBox.Show("There isn't events to show.", "Not registered to events"); } else { if (!EventsListBox.InvokeRequired) { EventBindingSource.DataSource = m_CurrentEvents; } else { EventsListBox.Invoke(new Action(() => EventBindingSource.DataSource = m_CurrentEvents)); } } } }
public void FetchUserEvents() { EventsListBox.Invoke(new Action(() => eventBindingSource.DataSource = User.Events)); }