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

Create Appt Exception Multiple DialogClosing Events

2 Answers 25 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Cliff McManus
Top achievements
Rank 1
Cliff McManus asked on 11 Dec 2013, 02:13 AM

When I drag an appointment to create an exception I receive the DialogClosing event from the RecurrenceChoiceDialog as expected.


However immediately after receiving this message I next receive two DialogClosing events of type RecurrenceDialogViewModel.



This is confusing to me. Is this functionality standard or might I be doing something wrong?



Here is a copy of my code for this method

#region xScheduleView_DialogClosing
        //DialogClosing - occurs when a ScheduleView dialog is about to be closed. The DialogClosing event handler receives two arguments: 
        // 1. The sender argument contains the RadScheduleView. This argument is of type object, but can be cast to the RadScheduleView type. 
        // 2. An CancelRoutedEventArgs object. After casting the CancelRoutedEventArgs to CloseDialogEventArgs you can access the following properties
        //    DialogViewModel - gets the scheduler dialog. The property can be cast to the following types: 
        //        1.AppointmentDialogViewModel
        //        2.RecurrenceChoiceDialogViewModel
        //        3.RecurrenceDialogViewModel
        //        4.ConfirmDialogViewModel
        //   Cancel - set this boolean property to True, when you want to cancel the event
 
        private void xScheduleView_DialogClosing(object sender, CancelRoutedEventArgs e)
        {               
            if ((((DialogEventArgs)e).DialogViewModel) is RecurrenceChoiceDialogViewModel)
            {
                // Returned from Recurrence Choice Dialog (Choose Occurrence or Series)
                RecurrenceChoiceDialogViewModel rCDVM = (((DialogEventArgs)e).DialogViewModel as RecurrenceChoiceDialogViewModel);
 
                if (rCDVM.IsOccurrenceModeSelected == true)
                {
                    // User selected to modify the Occurrence/exception
                    if ((rCDVM.RecurrenceChoiceDialogMode == RecurrenceChoiceDialogMode.Deleting))
                    {
                        functionBeingExecuted = FUNCTION_BEING_EXECUTED.DELETE;
                        if (rCDVM.Occurrence.OriginalStart == DateTime.MinValue)
                        {
                            // Recurring Appointment being deleted
                            functionBeingExecuted = FUNCTION_BEING_EXECUTED.ADD;
                            appointmentType       = APPOINTMENT_TYPE.OCCURRENCE;
                            //exceptionDateTime     = rCDVM.Occurrence.Start;                            
                        }
                        else
                        {
                            // Exception is being deleted
                            appointmentType   = APPOINTMENT_TYPE.OCCURRENCE;
                            // TODO: Stop here and verify you do not go through the Show dialog logic if you do then delete next line.
                            exceptionDateTime = rCDVM.Occurrence.OriginalStart;
                        }
                    }
                    else if ((rCDVM.RecurrenceChoiceDialogMode == RecurrenceChoiceDialogMode.Dragging))
	                {
                        // Dragging a single appt to create an exception/occurrence
                        // Change Function to Add 
                        functionBeingExecuted = FUNCTION_BEING_EXECUTED.ADD;
                        appointmentType       = APPOINTMENT_TYPE.OCCURRENCE;
	                }
                    else if ((rCDVM.RecurrenceChoiceDialogMode == RecurrenceChoiceDialogMode.Opening))
                    {
                        appointmentType       = APPOINTMENT_TYPE.OCCURRENCE;
                        exceptionDateTime = rCDVM.Occurrence.OriginalStart;
                    }
                } // rCDVM.IsOccurrenceModeSelected == true
                else if (rCDVM.IsSeriesModeSelected == true)
                {
                    // User selected to modify the Series
                    appointmentType = APPOINTMENT_TYPE.RECURRING;
                }
            }
            else if ((((DialogEventArgs)e).DialogViewModel) is AppointmentDialogViewModel)
            {
                // Returning from the Edit Appointment Dialog
                functionBeingExecuted           = FUNCTION_BEING_EXECUTED.EDIT;
                AppointmentDialogViewModel aDVM = (((DialogEventArgs)e).DialogViewModel as AppointmentDialogViewModel);
                if (aDVM.IsNotRecurrent == true)
                {
                    // This is a single appointment
                    appointmentType = APPOINTMENT_TYPE.NON_RECURRING;  
                    if (aDVM.Occurrence.State !=  RecurrenceState.Master)
                    {
                        // This is an exception / occurrence appointment
                        appointmentType = APPOINTMENT_TYPE.OCCURRENCE;
                    }
 
                }
                else
                {
                    // This is a recurring appointment
                    // Note the appointment may have started out on the open dialog as a non_recurring and had recurrence added
                    appointmentType = APPOINTMENT_TYPE.RECURRING;
                }
            }
            else if ((((DialogEventArgs)e).DialogViewModel) is RecurrenceDialogViewModel)
            {
                // Returning from Recurrence Dialog
                functionBeingExecuted = FUNCTION_BEING_EXECUTED.EDIT;
                RecurrenceDialogViewModel rDVM = (((DialogEventArgs)e).DialogViewModel as RecurrenceDialogViewModel);
                if (rDVM.Appointment.RecurrenceRule == null)
                {
                    // This is a non recurring appointment
                    appointmentType = APPOINTMENT_TYPE.NON_RECURRING;    
                }
                else
                {
                    // This is a recurring appointment
                    appointmentType = APPOINTMENT_TYPE.RECURRING; 
                }
            
            }
            else if ((((DialogEventArgs)e).DialogViewModel) is ConfirmDialogViewModel)
            {               
                // At this time no code is needed however this is added for future expansion
                //if (((CloseDialogEventArgs)e).DialogResult == true)
                //{
                   
                //}
                //else
                //{
 
                //}
            }
 
 
        }
        #endregion  //xScheduleView_DialogClosing


2 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 14 Dec 2013, 03:06 PM
Hi Cliff,

Thank you for reporting this issue to us.

I have logged it in our feedback portal where you could track its status. We will do our best to fix it for the next release.

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Cliff McManus
Top achievements
Rank 1
answered on 27 Dec 2013, 01:55 PM

I reworked my logic and simplified it greatly. I believe this to be an artifact of my convoluted logic rather than a telerik problem.

Item can be closed.

Cliff

Tags
ScheduleView
Asked by
Cliff McManus
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Cliff McManus
Top achievements
Rank 1
Share this question
or