private void AppointmentslistBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Constants.DefaultInitialIndex <= appointmentsListBox.SelectedIndex && appointmentsListBox.SelectedIndex < appointments.Count)
     {
         AppointmentInformationForm appointmentInformationForm = new AppointmentInformationForm(appointments[appointmentsListBox.SelectedIndex]);
         appointmentInformationForm.Show();
     }
 }
 private void InvitedAppointmentsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Constants.DefaultInitialIndex <= invitedAppointmentsListBox.SelectedIndex && invitedAppointmentsListBox.SelectedIndex < invitedAppointments.Count)
     {
         AppointmentInformationForm appointmentInformationForm = new AppointmentInformationForm(invitedAppointments[invitedAppointmentsListBox.SelectedIndex],
                                                                                                calendar, appointmentController, userController, this);
         appointmentInformationForm.Show();
     }
 }
 public EditAppointmentForm(Appointment appointment, AppointmentInformationForm appointmentInformationForm, CalendarForm calendarForm,
                            AppointmentsInDayForm appointmentsInDayForm, AppointmentController appointmentController, UserController userController)
 {
     InitializeComponent();
     this.appointment       = appointment;
     appointmentInformation = appointmentInformationForm;
     calendar          = calendarForm;
     appointmentsInDay = appointmentsInDayForm;
     AddUserNamesToLists();
     SetPreviousValues();
     notInvitedUserNamesListBox.DataSource = notInvitedUserNames;
     invitedUserNamesListBox.DataSource    = invitedUserNames;
     this.appointmentController            = appointmentController;
     this.userController = userController;
 }