'宣言 Public Overloads Function IsEnabled( _ ByVal eventid As TreeEventIds _ ) As Boolean
public bool IsEnabled( TreeEventIds eventid )
Imports Infragistics.Win.UltraWinTree Private Sub button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button20.Click If Me.ultraTree1.ActiveNode Is Nothing Then Return Dim eventManager As TreeEventManager ' Get the tree'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. eventManager = Me.ultraTree1.EventManager ' Disable the Before/AfterSelect events eventManager.SetEnabled(TreeEventIds.BeforeSelect, False) eventManager.SetEnabled(TreeEventIds.AfterSelect, False) ' Toggle the selection state of the active node. ' Note: This would normally cause the Before/AfterSelect ' events to be raised. However, since the above code ' disabled the events they won't be. Me.ultraTree1.ActiveNode.Selected = Not Me.ultraTree1.ActiveNode.Selected() ' Re-enable the Before/AfterSelect events eventManager.SetEnabled(TreeEventIds.BeforeSelect, True) eventManager.SetEnabled(TreeEventIds.AfterSelect, 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(TreeEventIds.BeforeSelect) Then eventManager.SetEnabled(TreeEventIds.BeforeSelect, True) End If ' The tree 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 ' 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(TreeEventIds.BeforeSelect) Then ' ... End If eventManager.SetEnabled(EventGroups.AfterEvents, True) End Sub
using Infragistics.Win.UltraWinTree; private void button20_Click(object sender, System.EventArgs e) { if ( this.ultraTree1.ActiveNode == null ) return; // Get the tree'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. TreeEventManager eventManager = this.ultraTree1.EventManager; // Disable the Before/AfterSelect events eventManager.SetEnabled( TreeEventIds.BeforeSelect, false ); eventManager.SetEnabled( TreeEventIds.AfterSelect, false ); // Toggle the selection state of the active node. // Note: This would normally cause the Before/AfterSelect // events to be raised. However, since the above code // disabled the events they won't be. this.ultraTree1.ActiveNode.Selected = !this.ultraTree1.ActiveNode.Selected; // Re-enable the Before/AfterSelect events eventManager.SetEnabled( TreeEventIds.BeforeSelect, true ); eventManager.SetEnabled( TreeEventIds.AfterSelect, 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(TreeEventIds.BeforeSelect ) ) eventManager.SetEnabled(TreeEventIds.BeforeSelect, true ); // The tree 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( TreeEventIds.BeforeSelect ) ) { // ... } }