This is a migrated thread and some comments may be shown as answers.

Appointment canceled

2 Answers 73 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 31 Dec 2012, 01:19 PM

Hi,

From my main form (where scheduler is), I am trying to add new appointment and show edit form like this:

IEvent newAppointment = new CustomAppointment();
newAppointment.Start = Record.RecordStart;
newAppointment.End = DateTime.Now;
// ...
 
cScheduler.Appointments.Add(newAppointment);
cScheduler.ShowAppointmentEditDialog(newAppointment, false);

The problem is when user click cancel or close button in edit form. After that appointment will be still in collection.
How to check if user cancel appointment and delete it form collection? 



2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Todorov
Telerik team
answered on 03 Jan 2013, 11:04 AM
Hi Dominik,

Thank you for your question.

The ShowAppointmentEditDialog method returns the DialogResult of the dialog so you can check it. The following code demonstrates how you can add the new appointment only if the OK button was clicked:
private void radButton1_Click(object sender, EventArgs e)
{
    IEvent newAppointment = new Appointment();
    newAppointment.Start = DateTime.Now.AddHours(-1);
    newAppointment.End = DateTime.Now;
    // ...
     
    if(cScheduler.ShowAppointmentEditDialog(newAppointment, false) == System.Windows.Forms.DialogResult.OK)
    {
        cScheduler.Appointments.Add(newAppointment);
    }
}

I hope you find this useful. Feel free to ask if you have any additional questions.

Kind regards,
Ivan Todorov
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
konrad
Top achievements
Rank 1
answered on 03 Jan 2013, 01:00 PM
Yep that will work fine.
Thank you very much!

Tags
Scheduler and Reminder
Asked by
konrad
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
konrad
Top achievements
Rank 1
Share this question
or