private void c1Schedule1_BeforeAppointmentShow(object sender, CancelAppointmentEventArgs e) { // Don't show built-in form e.Cancel = true; // Create ExcerciseForm for selected Appointment ExcerciseForm form = new ExcerciseForm(c1Schedule1, e.Appointment); // Show form form.ShowDialog(); }
private void c1Schedule1_BeforeAppointmentCreate(object sender, CancelAppointmentEventArgs e) { // Don't show built-in form e.Cancel = true; // Create new Appointment object with currently selected DateTime and default // exercise duration (45 minutes) Appointment app = c1Schedule1.DataStorage.AppointmentStorage.Appointments.Add( c1Schedule1.CurrentDate, TimeSpan.FromMinutes(45)); // Create ExcerciseForm for the new appointment ExcerciseForm form = new ExcerciseForm(c1Schedule1, app); // Show form if (form.ShowDialog() != DialogResult.OK) { // If user closes form without saving, remove appointment app.Delete(); } }