'宣言 Public Overloads Function InProgress( _ ByVal eventid As TabbedMdiEventIds _ ) As Boolean
public bool InProgress( TabbedMdiEventIds eventid )
特定のイベントが現時点でそのイベント コードを処理中かどうかを調べるには、InProgress メソッドを使用します。イベントを無効にするときは、その前に必ずイベントが処理中かどうかをチェックしてください。
注意 イベントの処理が完了する前にイベントを無効にすることは避けてください。まだ処理中のイベントを無効にした場合、予期しない結果を招くおそれがあります。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTabs Imports Infragistics.Win.UltraWinTabbedMdi Private Sub miEventManager_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miEventManager.Click ' 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. ' Get the component's event manager. Dim eventManager As TabbedMdiEventManager = Me.ultraTabbedMdiManager1.EventManager ' Disable the events that will be invoked when a tab is moved ' to a new group eventManager.SetEnabled(TabbedMdiEventIds.TabGroupResizing, False) eventManager.SetEnabled(TabbedMdiEventIds.TabGroupResized, False) eventManager.SetEnabled(TabbedMdiEventIds.TabMoving, False) eventManager.SetEnabled(TabbedMdiEventIds.TabMoved, False) ' Move a tab in the first group to a new group ' Note: Moving the tab to a new group will normally cause the ' TabMoving/ed and TabGroupResizing/ed events to be invoked since ' we have disabled them, they won't be raised. If Me.ultraTabbedMdiManager1.TabGroups.Count > 0 AndAlso Me.ultraTabbedMdiManager1.TabGroups(0).Tabs.Count > 1 Then Me.ultraTabbedMdiManager1.TabGroups(0).Tabs(0).MoveToNewGroup(MdiTabGroupPosition.Last) End If ' Re-enable the events eventManager.SetEnabled(TabbedMdiEventIds.TabGroupResizing, True) eventManager.SetEnabled(TabbedMdiEventIds.TabGroupResized, True) eventManager.SetEnabled(TabbedMdiEventIds.TabMoving, True) eventManager.SetEnabled(TabbedMdiEventIds.TabMoved, 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(TabbedMdiEventIds.InitializeTab) Then eventManager.SetEnabled(TabbedMdiEventIds.InitializeTab, 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. If Not eventManager.IsEnabled(TabbedMdiEventGroups.BeforeEvents) Then eventManager.SetEnabled(TabbedMdiEventGroups.BeforeEvents, True) End If eventManager.SetEnabled(TabbedMdiEventGroups.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(TabbedMdiEventIds.TabDisplaying) Then ' ... End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void miEventManager_Click(object sender, System.EventArgs e) { // 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. // Get the component's event manager. TabbedMdiEventManager eventManager = this.ultraTabbedMdiManager1.EventManager; // Disable the events that will be invoked when a tab is moved // to a new group eventManager.SetEnabled( TabbedMdiEventIds.TabGroupResizing, false ); eventManager.SetEnabled( TabbedMdiEventIds.TabGroupResized, false ); eventManager.SetEnabled( TabbedMdiEventIds.TabMoving, false ); eventManager.SetEnabled( TabbedMdiEventIds.TabMoved, false ); // Move a tab in the first group to a new group // Note: Moving the tab to a new group will normally cause the // TabMoving/ed and TabGroupResizing/ed events to be invoked since // we have disabled them, they won't be raised. if (this.ultraTabbedMdiManager1.TabGroups.Count > 0 && this.ultraTabbedMdiManager1.TabGroups[0].Tabs.Count > 1) { this.ultraTabbedMdiManager1.TabGroups[0].Tabs[0].MoveToNewGroup(MdiTabGroupPosition.Last); } // Re-enable the events eventManager.SetEnabled( TabbedMdiEventIds.TabGroupResizing, true ); eventManager.SetEnabled( TabbedMdiEventIds.TabGroupResized, true ); eventManager.SetEnabled( TabbedMdiEventIds.TabMoving, true ); eventManager.SetEnabled( TabbedMdiEventIds.TabMoved, 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(TabbedMdiEventIds.InitializeTab ) ) eventManager.SetEnabled(TabbedMdiEventIds.InitializeTab, 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. if ( !eventManager.IsEnabled(TabbedMdiEventGroups.BeforeEvents ) ) eventManager.SetEnabled(TabbedMdiEventGroups.BeforeEvents, true ); eventManager.SetEnabled(TabbedMdiEventGroups.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( TabbedMdiEventIds.TabDisplaying ) ) { // ... } }