void ApplyRecurrence(AppointmentFormController controller, DateTime clientStart) { Appointment patternCopy = controller.PrepareToRecurrenceEdit(); AssignRecurrenceInfoProperties(controller, patternCopy, (RecurrenceInfo)patternCopy.RecurrenceInfo, clientStart); controller.ApplyRecurrence(patternCopy); }
void btnOK_Click(object sender, System.EventArgs e) { ValidationArgs args = new ValidationArgs(); currentRecurrenceControl.ValidateValues(args); if (args.Valid) { args = new ValidationArgs(); currentRecurrenceControl.CheckForWarnings(args); if (!args.Valid) { DialogResult answer = MessageBox.Show(this, args.ErrorMessage, Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (answer == DialogResult.OK) { this.DialogResult = DialogResult.OK; } else { if (args.Control != null) { ((Control)args.Control).Focus(); } } } else { // Apply changes to the appointment recurrence pattern. controller.ApplyRecurrence(patternCopy); } // Apply changes to the original appointment. controller.ApplyChanges(); this.DialogResult = DialogResult.OK; } else { MessageBox.Show(this, args.ErrorMessage, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (args.Control != null) { ((Control)args.Control).Focus(); } } }