示例#1
0
        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");
                }
            }

                                     )
                                 );
        }
示例#2
0
 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));
             }
         }
     }
 }
示例#3
0
 public void FetchUserEvents()
 {
     EventsListBox.Invoke(new Action(() => eventBindingSource.DataSource = User.Events));
 }