Version

EventManager Property

The object that enables, disables and controls firing of specific component events.
Syntax
'Declaration
 
Public ReadOnly Property EventManager As ToolbarsEventManager
public ToolbarsEventManager EventManager {get;}
Remarks

The EventManager provides a high degree of control over how the control invokes event procedures. You can use it to selectively enable and disable event procedures depending on the context of your application. You can also use the event manager to return information about the state of the control's events.

The event manager's methods are used to determine the enabled state of an event (ToolbarsEventManager.IsEnabled), to selectively enable or disable events (ToolbarsEventManager.SetEnabled), and to determine whether an event procedure is currently being processed (InProgress(ToolbarEventIds)). There is also an Infragistics.Shared.EventManagerBase.AllEventsEnabled property that you can check to quickly determine whether any events have been disabled by the event manager.

Example
The following sample code illustrates how to use the UltraToolbarManager's EventManager.

Imports Infragistics.Win.UltraWinToolbars

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

    ' Get the toolbar manager'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 ToolbarsEventManager

    eventManager = Me.ultraToolbarsManager1.EventManager

    ' Disable the ToolClick event
    eventManager.SetEnabled(ToolbarEventIds.ToolClick, False)

    ' Toggle the 'Checked' property of a state button tool.
    ' Note: This would normally cause the ToolClick event to 
    ' be raised. However, since the above code disabled the event
    ' it won't be raised.
    Dim tool As StateButtonTool

    tool = Me.ultraToolbarsManager1.Tools("StateButtonTool1")
    tool.Checked = Not tool.Checked

    ' Re-enable the ToolClick event
    eventManager.SetEnabled(ToolbarEventIds.ToolClick, 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(ToolbarEventIds.ToolClick) Then
        eventManager.SetEnabled(ToolbarEventIds.ToolClick, True)
    End If

    ' The status bar 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(EventGroups.BeforeEvents) Then
        eventManager.SetEnabled(EventGroups.BeforeEvents, True)
    End If

    eventManager.SetEnabled(EventGroups.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(ToolbarEventIds.ToolClick) Then
        ' ... 
    End If

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

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

	// Get the toolbar manager'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.
	ToolbarsEventManager eventManager = this.ultraToolbarsManager1.EventManager;

	// Disable the ToolClick event
	eventManager.SetEnabled( ToolbarEventIds.ToolClick, false );

	// Toggle the 'Checked' property of a state button tool.
	// Note: This would normally cause the ToolClick event to 
	// be raised. However, since the above code disabled the event
	// it won't be raised.
	StateButtonTool tool;

	tool = this.ultraToolbarsManager1.Tools["StateButtonTool1"] as StateButtonTool;
	tool.Checked = !tool.Checked;

	// Re-enable the ToolClick event
	eventManager.SetEnabled( ToolbarEventIds.ToolClick, 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(ToolbarEventIds.ToolClick ) )
		eventManager.SetEnabled(ToolbarEventIds.ToolClick, true );

	// The status bar 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(EventGroups.BeforeEvents ) )
		eventManager.SetEnabled(EventGroups.BeforeEvents, true );

	eventManager.SetEnabled(EventGroups.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( ToolbarEventIds.ToolClick ) )
	{
		// ... 
	}
	
}
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