'宣言 Public ReadOnly Property EventManager As UltraExplorerBarEventManager
public UltraExplorerBarEventManager EventManager {get;}
EventManager はコントロールによるイベント プロシージャーの呼び出し方法に関する高度な管理機能を提供します。これを使用すれば、アプリケーションのコンテキストに応じてイベントプロシージャーを選択的に有効または無効にできます。また、イベント マネージャを使用してコンポーネントのイベントの状態に関する情報を返すこともできます。
イベントマネージャのメソッドは、イベントのEnabled状態の確認 (UltraExplorerBarEventManager.IsEnabled)、イベントの選択的な有効化または無効化 (UltraExplorerBarEventManager.SetEnabled)、およびイベントプロシージャーが現在処理中かどうかの確認 (UltraExplorerBarEventManager.InProgress) に使用します。
Imports System.Diagnostics Imports Infragistics.Win Imports Infragistics.Win.UltraWinExplorerBar Private Sub button94_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button94.Click ' Get UltraExplorerBar'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 UltraExplorerBarEventManager = Me.ultraExplorerBar1.EventManager ' Disable the ActiveGroupChanged/ActiveGroupChanging events eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, False) eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, False) ' The event manager exposes an 'IsEnabled' method to see if an event ' is enabled or disbled. Display the enabled status of the ' ActiveGroupChanged/ActiveGroupChanging events to verify that they are disabled. Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString())) Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString())) ' Re-enable the ActiveGroupChanged/ActiveGroupChanging events eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, True) eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, True) ' Display the enabled status of the ActiveGroupChanged/ActiveGroupChanging events ' to verif that they have been re-enabled. Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString())) Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString())) ' 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 = False) Then eventManager.AllEventsEnabled = True 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. eventManager.SetEnabled(UltraExplorerBarEventGroups.AfterEvents, False) Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the 'before' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.BeforeEvents).ToString())) Debug.WriteLine(String.Format("IsEnabled returns '{0}' for the 'after' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.AfterEvents).ToString())) eventManager.SetEnabled(UltraExplorerBarEventGroups.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(UltraExplorerBarEventIds.GroupAdding)) Then ' ... End If End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinExplorerBar; private void button94_Click(object sender, System.EventArgs e) { // Get UltraExplorerBar'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. UltraExplorerBarEventManager eventManager = this.ultraExplorerBar1.EventManager; // Disable the ActiveGroupChanged/ActiveGroupChanging events eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, false ); eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, false ); // The event manager exposes an 'IsEnabled' method to see if an event // is enabled or disbled. Display the enabled status of the // ActiveGroupChanged/ActiveGroupChanging events to verify that they are disabled. Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString())); Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString())); // Re-enable the ActiveGroupChanged/ActiveGroupChanging events eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanging, true ); eventManager.SetEnabled(UltraExplorerBarEventIds.ActiveGroupChanged, true ); // Display the enabled status of the ActiveGroupChanged/ActiveGroupChanging events // to verif that they have been re-enabled. Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanged event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanged).ToString())); Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the ActiveGroupChanging event", eventManager.IsEnabled(UltraExplorerBarEventIds.ActiveGroupChanging).ToString())); // 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 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. eventManager.SetEnabled(UltraExplorerBarEventGroups.AfterEvents, false); Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the 'before' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.BeforeEvents).ToString())); Debug.WriteLine(string.Format("IsEnabled returns '{0}' for the 'after' events", eventManager.IsEnabled(UltraExplorerBarEventGroups.AfterEvents).ToString())); eventManager.SetEnabled(UltraExplorerBarEventGroups.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(UltraExplorerBarEventIds.GroupAdding)) { // ... } }