Exemplo n.º 1
0
        private void dateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            DateTime chosenDate = dateTimePicker.Value;

            if (IsAvailableDate(chosenDate))
            {
                RequestShowingsList?.Invoke(chosenDate);
            }
            else
            {
                MessageBox.Show("Tego dnia nie odbywa się żaden seans", "Błąd", MessageBoxButtons.OK);
            }
        }
        private void InitializeMainForm(string username)
        {
            mainForm = new MainForm();
            mainForm.RequestLogOut        += () => RequestLogOut?.Invoke();
            mainForm.RequestBookingsList  += () => RequestBookingsList?.Invoke();
            mainForm.RequestShowingsList  += (DateTime date) => RequestShowingsList?.Invoke(date);
            mainForm.RequestSeatsList     += (int showingId) => RequestSeatsList.Invoke(showingId);
            mainForm.RequestShowingsDates += () => RequestShowingsDates?.Invoke();
            mainForm.RequestBookShowing   += (BookSeatsRequest request) => RequestBookShowing?.Invoke(request);

            mainForm.FormClosing += (object sender, FormClosingEventArgs e) => activeForm = null;

            mainForm.SetLoggedUser(username);
        }
Exemplo n.º 3
0
        public MainForm()
        {
            bookingsListControl = new BookingsList();
            chooseDateControl   = new DateControl();
            showingsListControl = new ShowingsListBox();
            seatsViewControl    = new SeatsView();

            InitializeControl(bookingsListControl);
            InitializeControl(chooseDateControl);
            InitializeControl(showingsListControl);
            InitializeControl(seatsViewControl);
            InitializeComponent();

            chooseDateControl.RequestShowingsDates += () => RequestShowingsDates?.Invoke();
            chooseDateControl.RequestShowingsList  += (DateTime date) => RequestShowingsList?.Invoke(date);
            showingsListControl.RequestSeatsList   += (int id) => RequestSeatsList?.Invoke(id);
            seatsViewControl.RequestBookShowing    += (BookSeatsRequest request) => RequestBookShowing?.Invoke(request);
        }