'Declaration Public Event BeforeDisplayAppointmentDialog As DisplayAppointmentDialogEventHandler
public event DisplayAppointmentDialogEventHandler BeforeDisplayAppointmentDialog
The event handler receives an argument of type DisplayAppointmentDialogEventArgs containing data related to this event. The following DisplayAppointmentDialogEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Appointment (Inherited from Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs) | Returns the appointment object associated with the event. This property is read-only. |
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
IsExistingAppointment | Indicates if the CancelableAppointmentEventArgs.Appointment is an existing Appointment object. |
RecurrenceEditType | Gets/sets how the CancelableAppointmentEventArgs.Appointment is opened for editing. |
An AppointmentDialog may be displayed using the DisplayAppointmentDialog(Appointment) method or through the UltraDayView, UltraMonthViewSingle, UltraWeekView, and UltraMonthViewMulti when UltraDayView.AutoAppointmentDialog is true.
The dialog may be displayed for a new or existing Appointment object. When displayed for an existing Appointment, the DisplayAppointmentDialogEventArgs.IsExistingAppointment will return true. When this property returns false, the CancelableAppointmentEventArgs.Appointment object is a new Appointment that has not been added to the Appointments collection and the values of the Appointment may be changed to update the values that will be displayed in the dialog.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Sub ultraCalendarInfo1_BeforeDisplayAppointmentDialog(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.DisplayAppointmentDialogEventArgs) Handles ultraCalendarInfo1.BeforeDisplayAppointmentDialog '---------------------------------------------------------------------------------------------------- ' Description ' BeforeDisplayAppointmentDialog ' ' Fires before the Appointment dialog is displayed ' If canceled, the Appointment dialog is not displayed, and the AfterDisplayAppointmentDialog event does not fire. ' '---------------------------------------------------------------------------------------------------- If Not e.IsExistingAppointment Then If e.Appointment.StartDateTime < DateTime.Today Then ' To prevent the displaying of the AppointmentDialog, set the Cancel ' property to true e.Cancel = True ' Let the end user know what happened Dim info As String = String.Empty info += "Sorry, but you cannot add new appointments in the past." MessageBox.Show(info, "BeforeDisplayAppointmentDialog", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Else ' this must be an existing appointment for which the dialog ' will be displayed... ' if this is a recurring appointment instance... If Not e.Appointment.RecurringAppointmentRoot Is Nothing Then ' Outlook prompts the user as to whether the series ' or the occurrence should be edited. In UltraCalendarInfo, ' this can be controlled by setting the 'RecurrenceEditType' ' of the event arguments. ' ' if the appointment is already a variance (a modified occurrence) ' then let them edit the occurrence information If e.Appointment.IsVariance Then e.RecurrenceEditType = RecurrenceEditType.Occurrence Else 'otherwise, let them edit the series so they don't create variances Then e.RecurrenceEditType = RecurrenceEditType.Series End If End If End If End Sub
using System.Diagnostics; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; private void ultraCalendarInfo1_BeforeDisplayAppointmentDialog(object sender, Infragistics.Win.UltraWinSchedule.DisplayAppointmentDialogEventArgs e) { //---------------------------------------------------------------------------------------------------- // Description // BeforeDisplayAppointmentDialog // // Fires before the Appointment dialog is displayed // If canceled, the Appointment dialog is not displayed, and the AfterDisplayAppointmentDialog event does not fire. // //---------------------------------------------------------------------------------------------------- if ( ! e.IsExistingAppointment ) { if (e.Appointment.StartDateTime < DateTime.Today) { // To prevent the displaying of the AppointmentDialog, set the Cancel // property to true e.Cancel = true; // Let the end user know what happened string info = string.Empty; info += "Sorry, but you cannot add new appointments in the past."; MessageBox.Show( info, "BeforeDisplayAppointmentDialog", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } else { // this must be an existing appointment for which the dialog // will be displayed... // if this is a recurring appointment instance... if (e.Appointment.RecurringAppointmentRoot != null) { // Outlook prompts the user as to whether the series // or the occurrence should be edited. In UltraCalendarInfo, // this can be controlled by setting the 'RecurrenceEditType' // of the event arguments. // // if the appointment is already a variance (a modified occurrence) // then let them edit the occurrence information if (e.Appointment.IsVariance) e.RecurrenceEditType = RecurrenceEditType.Occurrence; else //otherwise, let them edit the series so they don't create variances e.RecurrenceEditType = RecurrenceEditType.Series; } } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2