private void LoadSettingsFromEvent(IEvent sourceEvent)
        {
            // appointment settings
            this.txtSubject.Text     = sourceEvent.Summary;
            this.txtLocation.Text    = sourceEvent.Location;
            this.txtDescription.Text = sourceEvent.Description;

            this.cmbShowTimeAs.SelectedValue = sourceEvent.StatusId;

            this.SetStartDateAndTime(sourceEvent.Start);
            this.SetEndDateAndTime(sourceEvent.End);

            double totalHours = sourceEvent.Duration.TotalHours;
            bool   isAllDay   = totalHours >= 23.99 && Math.Round(totalHours) % 24 == 0;

            this.chkAllDay.ToggleState = isAllDay ? ToggleState.On : ToggleState.Off;

            if (this.appointment != null && this.schedulerData != null)
            {
                this.btnDelete.Enabled = schedulerData.GetEventStorage().Contains(this.appointment) && sourceEvent.AllowDelete;
            }

            this.SetTimePickersEnabledState(isAllDay);

            // OutlookLike settings
            OutlookLikeAppointment outlookAppointment = sourceEvent as OutlookLikeAppointment;

            if (outlookAppointment == null)
            {
                this.txtEmail.Text = String.Empty;
                return;
            }
            this.txtEmail.Text = outlookAppointment.Email;
        }
        protected override Event CreateOccurrenceInstance()
        {
            OutlookLikeAppointment occurrence = new OutlookLikeAppointment();

            occurrence.email = this.email;
            return(occurrence);
        }
        private void ApplySettingsToEvent(IEvent targetEvent)
        {
            // appointment settings
            targetEvent.Summary     = this.txtSubject.Text;
            targetEvent.Location    = this.txtLocation.Text;
            targetEvent.Description = this.txtDescription.Text;

            object selectedStatus = this.cmbShowTimeAs.SelectedValue;

            targetEvent.StatusId = (selectedStatus != null) ? (int)selectedStatus : 1;

            targetEvent.Start = this.GetAppointmentStart();
            targetEvent.End   = this.GetAppointmentEnd();

            if (this.RecurrenceSettingsShouldBeSaved())
            {
                targetEvent.RecurrenceRule = this.recurringAppointment.RecurrenceRule;
            }

            // if we are editing an occurrence, add an exception
            if (targetEvent.MasterEvent != null)
            {
                if (!targetEvent.MasterEvent.Exceptions.Contains(targetEvent))
                {
                    if (targetEvent.RecurrenceId == null)
                    {
                        targetEvent.RecurrenceId = targetEvent.Start;
                    }
                    targetEvent.MasterEvent.Exceptions.Add(targetEvent);
                }
            }

            // OutlookLike settings
            OutlookLikeAppointment outlookAppointment = targetEvent as OutlookLikeAppointment;

            if (outlookAppointment == null)
            {
                return;
            }
            outlookAppointment.Email = this.txtEmail.Text;
        }