'Declaration Protected Overridable Sub OnBeforeDisplayAppointmentDialog( _ ByVal e As DisplayAppointmentDialogEventArgs _ )
protected virtual void OnBeforeDisplayAppointmentDialog( DisplayAppointmentDialogEventArgs e )
Raising an event invokes the event handler through a delegate.
The OnBeforeDisplayAppointmentDialog method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors: When overriding OnBeforeDisplayAppointmentDialog in a derived class, be sure to call the base class's OnBeforeDisplayAppointmentDialog method so that registered delegates receive the event.
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