private void ticketsButton_Click(object sender, EventArgs e) { string selectedDate = this.dateBox.SelectedItem.ToString(); string selectedTime = this.hourBox.SelectedItem.ToString(); DateTime screeningDate = screeningService.GetDateTimeFromDateAndTime(selectedDate, selectedTime); TicketForm.Screening = screeningService.GetScreening(this._townName, this._cinemaName, this._movieName, screeningDate); TicketTypeForm ticketTypeForm = new TicketTypeForm(); ticketTypeForm.TopLevel = false; ticketTypeForm.AutoScroll = true; this.Parent.Controls.Add(ticketTypeForm); ticketTypeForm.Show(); this.Hide(); }
private void selectTicketTypeButton_Click(object sender, EventArgs e) { var dateTime = screeningService.GetDateTimeFromDateAndTime(_date, _time); TicketForm.Screening = screeningService.GetScreening(this._townName, this._cinemaName, this._movieName, dateTime); TicketTypeForm ticketTypeForm = new TicketTypeForm(); ticketTypeForm.TopLevel = false; ticketTypeForm.AutoScroll = true; this.Hide(); var contentHolder = ((Button)sender).Parent.Parent; var formsCount = contentHolder.Controls.Count; if (formsCount - 1 <= contentHolder.Controls.IndexOf(this)) { contentHolder.Controls.Add(ticketTypeForm); ticketTypeForm.Show(); } else { contentHolder.Controls[contentHolder.Controls.IndexOf(this) + 1].Show(); } }