/// <summary>
        /// Display the dialog and return the appropriate DialogResults.
        /// If the user doesn't click OK to close the dialog, return null.
        /// </summary>
        /// <param name="service">ServiceBinding used to make requests.</param>
        /// <param name="appointments">Output parameter</param>
        /// <returns>DialogResult</returns>
        public static DialogResult ShowDialog(ExchangeService service, ref List <ItemId> appointments)
        {
            FindAppointmentsDialog dialog = new FindAppointmentsDialog();

            dialog.CurrentService = service;

            dialog.txtStartTime.Text = DateTime.Now.ToString();
            dialog.txtEndTime.Text   = DateTime.Now.ToString();

            DialogResult res = ((Form)dialog).ShowDialog();

            if (res == DialogResult.OK)
            {
                AppointmentsContentForm.Show(
                    string.Format(
                        "CalendarView from {0} to {1} in {2}.",
                        dialog.txtStartTime.Text,
                        dialog.txtEndTime.Text,
                        dialog.CurrentCalendar),
                    dialog.AppointmentsFound,
                    dialog.CurrentService,
                    dialog.ParentForm);
            }

            return(res);
        }
        /// <summary>
        /// Load the form with the appointments in the collection.
        /// </summary>
        /// <param name="caption">Text to append to the form title.</param>
        /// <param name="appointments">Appointments to display.</param>
        /// <param name="service">Current ExchangeService to use.</param>
        /// <param name="parentForm">Parent form that called this method.</param>
        public static void Show(
            string caption,
            List <Appointment> appointments,
            ExchangeService service,
            Form parentForm)
        {
            AppointmentsContentForm form = new AppointmentsContentForm();

            form.CurrentService      = service;
            form.currentAppointments = appointments;
            form.PropertyDetailsGrid.CurrentService = service;
            form.Text        = caption;
            form.CallingForm = parentForm;
            form.Show();
        }