Version

CanFireEvent Method (CalendarLookEventManager)

Indicates whether the event identified by the CalendarInfoEventIds can be fired.
Syntax
'Declaration
 
Public Function CanFireEvent( _
   ByVal eventid As CalendarLookEventIds _
) As Boolean
public bool CanFireEvent( 
   CalendarLookEventIds eventid
)

Parameters

eventid
Identifies which event to check.

Return Value

True if the specified event can be fired.
Example
The following code demonstrates how to use UltraCalendarLook's Event Manager to enable/disable events and event groups, and to check to see whether specific events or event groups are enabled.

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

	Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click

		' Get the UltraCalendarLook's event manager.
		' The event manager is used to temporarily disable events
		' to prevent them from being raised. This can be very
		' convenient in a situation where one or more properties
		' are being set in code and the events they would normally 
		' raise would cause unnecessary or counter-productive
		' code to be executed.
		'
		' Note: All events are enabled by default.
		Dim eventManager As CalendarLookEventManager = Me.UltraCalendarLook1.EventManager


		' Disable the CalendarLookChanged event
		eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, False)


		' Re-enable the CalendarLookChanged event
		eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, True)


		' The 'AllEventsEnabled' property lets you enable/disable
		' all events will a single line of code. If any event is 
		' disabled the 'AllEventsEnabled' property returns false.
		If Not eventManager.AllEventsEnabled Then
			eventManager.AllEventsEnabled = True
		End If


		' The event manager also exposes an 'IsEnabled' method
		' to see if an event is enabled or disbled.
		If Not eventManager.IsEnabled(CalendarLookEventIds.CalendarLookChanged) Then
			eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, True)
		End If


		' The CanFireEvent method indicates whether the specified event can be fired.
		' This can return false if the control is not in the correct state for the
		' specified event to be fired.
		If eventManager.CanFireEvent(CalendarLookEventIds.CalendarLookChanged) Then
			Debug.WriteLine("The CalendarLookChanged event can be fired at this time.")
		Else
			Debug.WriteLine("The CalendarLookChanged event CANNOT be fired at this time.")
		End If


		' The event manager also exposes overloaded 
		' 'IsEnabled' and 'SetEnabled' methods that take an  
		' event group so that, for example all 'Before' or all
		' 'After' events can be enabled/disabled. If any event
		' in the group is disabled the 'IsEnabled' method returns
		' false.
		If Not eventManager.IsEnabled(CalendarLookEventGroups.AfterEvents) Then
			eventManager.SetEnabled(CalendarLookEventGroups.AfterEvents, True)
		End If


		' The 'InProgress' method will return true if the 
		' specified event is currently being raised. This
		' is often helpful in methods that can be called
		' from various points in an application to determine
		' what is triggering the call.
		If eventManager.InProgress(CalendarLookEventIds.CalendarLookChanged) Then
			' ... 
		End If

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

		private void button18_Click(object sender, System.EventArgs e)
		{

			// Get the UltraCalendarLook's event manager.
			// The event manager is used to temporarily disable events
			// to prevent them from being raised. This can be very
			// convenient in a situation where one or more properties
			// are being set in code and the events they would normally 
			// raise would cause unnecessary or counter-productive
			// code to be executed.
			//
			// Note: All events are enabled by default.
			CalendarLookEventManager eventManager = this.ultraCalendarLook1.EventManager;


			// Disable the CalendarLookChanged event
			eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, false);


			// Re-enable the CalendarLookChanged event
			eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, true);


			// The 'AllEventsEnabled' property lets you enable/disable
			// all events will a single line of code. If any event is 
			// disabled the 'AllEventsEnabled' property returns false.
			if ( !eventManager.AllEventsEnabled )
				eventManager.AllEventsEnabled = true;


			// The event manager also exposes an 'IsEnabled' method
			// to see if an event is enabled or disbled.
			if (!eventManager.IsEnabled(CalendarLookEventIds.CalendarLookChanged))
				eventManager.SetEnabled(CalendarLookEventIds.CalendarLookChanged, true );


			// The CanFireEvent method indicates whether the specified event can be fired.
			// This can return false if the control is not in the correct state for the
			// specified event to be fired.
			if (eventManager.CanFireEvent(CalendarLookEventIds.CalendarLookChanged))
				Debug.WriteLine("The CalendarLookChanged event can be fired at this time.");
			else
				Debug.WriteLine("The CalendarLookChanged event CANNOT be fired at this time.");


			// The event manager also exposes overloaded 
			// 'IsEnabled' and 'SetEnabled' methods that take an  
			// event group so that, for example all 'Before' or all
			// 'After' events can be enabled/disabled. If any event
			// in the group is disabled the 'IsEnabled' method returns
			// false.
			if (!eventManager.IsEnabled(CalendarLookEventGroups.AfterEvents))
				eventManager.SetEnabled(CalendarLookEventGroups.AfterEvents, true );


			// The 'InProgress' method will return true if the 
			// specified event is currently being raised. This
			// is often helpful in methods that can be called
			// from various points in an application to determine
			// what is triggering the call.
			if (eventManager.InProgress(CalendarLookEventIds.CalendarLookChanged))
			{
				// ... 
			}

		}
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