Version

BeforeInvokeAppointmentAction Event

Fired before the action for an appointment is invoked.
Syntax
'Declaration
 
Public Event BeforeInvokeAppointmentAction As CancelableAppointmentEventHandler
public event CancelableAppointmentEventHandler BeforeInvokeAppointmentAction
Event Data

The event handler receives an argument of type CancelableAppointmentEventArgs containing data related to this event. The following CancelableAppointmentEventArgs properties provide information specific to this event.

PropertyDescription
Appointment Returns the appointment object associated with the event. This property is read-only.
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Remarks

The BeforeInvokeAppointmentAction event may be canceled using System.ComponentModel.CancelEventArgs.Cancel property to prevent the ReminderDialog from being displayed for the specified Appointment.

The CancelableAppointmentEventArgs.Appointment property returns the Appointment whose Appointment.Action will be invoked.

Example
This example checks the AppointmentAction's Type property to see if the action is set to execute a program if it is, the action's invocation is canceled, and the end user is notified.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule
Imports System.Diagnostics

    Private Sub ultraCalendarInfo1_BeforeInvokeAppointmentAction(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs) Handles ultraCalendarInfo1.BeforeInvokeAppointmentAction

        '----------------------------------------------------------------------------------------------------
        '	Description
        '	BeforeInvokeAppointmentAction
        '
        '	Fires before an Appointment's action is invoked
        '
        '	An Appointment object can be assigned an AppointmentAction via its Action property.
        '	The AppointmentAction can, for example, launch an application when an appointment
        '	becomes due. In this scenario, the BeforeInvokeAppointmentAction would fire prior
        '	the application being launched.
        '
        '----------------------------------------------------------------------------------------------------

        If (e.Appointment.Action.Type = AppointmentActionType.ExecuteProgram) Then
            '	To prevent the removal of the Appointment, set the Cancel
            '	property to true
            e.Cancel = True

            '	Let the end user know what happened
            Dim info As String = String.Empty
            info += "You do not have sufficient permissions to execute programs." + vbCrLf

            MessageBox.Show(info, "BeforeInvokeAppointmentAction", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If

    End Sub
using System.Diagnostics;
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinSchedule;

		private void ultraCalendarInfo1_BeforeInvokeAppointmentAction(object sender, Infragistics.Win.UltraWinSchedule.CancelableAppointmentEventArgs e)
		{		

			//----------------------------------------------------------------------------------------------------
			//	Description
			//	BeforeInvokeAppointmentAction
			//
			//	Fires before an Appointment's action is invoked
			//
			//	An Appointment object can be assigned an AppointmentAction via its Action property.
			//	The AppointmentAction can, for example, launch an application when an appointment
			//	becomes due. In this scenario, the BeforeInvokeAppointmentAction would fire prior
			//	the application being launched.
			//
			//----------------------------------------------------------------------------------------------------
		
			if ( e.Appointment.Action.Type == AppointmentActionType.ExecuteProgram )
			{
				//	To prevent the removal of the Appointment, set the Cancel
				//	property to true
				e.Cancel = true;

				//	Let the end user know what happened
				string info = string.Empty;
				info += "You do not have sufficient permissions to execute programs." + "\n";

				MessageBox.Show( info, "BeforeInvokeAppointmentAction", MessageBoxButtons.OK, MessageBoxIcon.Error );
			}

		}
Requirements

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

See Also