Create Appt Exception Multiple DialogClosing Events

3 posts, 0 answers
  1. Cliff McManus
    Cliff McManus avatar
    32 posts
    Member since:
    Mar 2011

    Posted 10 Dec 2013 Link to this post

    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. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 14 Dec 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Cliff McManus
    Cliff McManus avatar
    32 posts
    Member since:
    Mar 2011

    Posted 27 Dec 2013 Link to this post

    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

Back to Top