예제 #1
0
        public void AddEventToUI(Event ev)
        {
            AllEvents.Add(ev);

            // Today's events
            if (EventFilter.Today().Matches(ev))
            {
                // Remove "NoEventsToday" panel
                foreach (Control control in todaysEventsFllpnl.Controls)
                {
                    if (control is NoEventsToday)
                    {
                        todaysEventsFllpnl.Controls.Remove(control);
                    }
                }

                todaysEventsFllpnl.Controls.Add(new EventComponent(ev));
                flowLayoutPanelToday.Controls.Add(new EventComponent(ev));
            }

            // Upcoming events
            if (EventFilter.Upcoming().Matches(ev))
            {
                flowLayoutPanelUpcoming.Controls.Add(new EventComponent(ev));
            }

            // Created events
            if (EventFilter.Involved(EventInvolvement.Creator).Matches(ev))
            {
                // Remove "NoEventsCreated" panel
                foreach (Control control in CreatedEventsFllpnl.Controls)
                {
                    if (control is NoEventsCreated)
                    {
                        CreatedEventsFllpnl.Controls.Remove(control);
                    }
                }

                CreatedEventsFllpnl.Controls.Add(new EventComponentAddParticipant(ev));
            }
        }