バージョン

EventManager プロパティ (UltraDayView)

UltraDayView 固有のイベントを有効または無効にし、イベントの発生を制御するオブジェクトを返します。
シンタックス
'宣言
 
Public ReadOnly Property EventManager As DayViewEventManager
public DayViewEventManager EventManager {get;}
解説

UltraDayView イベント マネージャーは、UltraDayView のイベント プロシージャーの呼び出し方法を高レベルに制御することができます。これを使用すれば、アプリケーションのコンテキストに応じてイベントプロシージャーを選択的に有効または無効にできます。また、イベント マネージャを使用してコンポーネントのイベントの状態に関する情報を返すこともできます。

使用例
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinSchedule

	Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

		' Get the UltraDayView'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 DayViewEventManager = Me.UltraDayView1.EventManager


		' Disable the Before/AfterTimeSlotSelectionChanged events
		eventManager.SetEnabled(DayViewEventIds.BeforeTimeSlotSelectionChanged, False)
		eventManager.SetEnabled(DayViewEventIds.AfterTimeSlotSelectionChanged, False)


		' Select the same time slot in the next day.
		' Note: This would normally cause the Before/AfterSelectChange 
		' events to be raised. However, since the above code disabled
		' the events they won't be.
		Me.UltraDayView1.PerformAction(UltraDayViewAction.SameTimeSlotNextDay)


		' Re-enable the Before/AfterTimeSlotSelectionChanged events
		eventManager.SetEnabled(DayViewEventIds.BeforeTimeSlotSelectionChanged, True)
		eventManager.SetEnabled(DayViewEventIds.AfterTimeSlotSelectionChanged, 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(DayViewEventIds.BeforeAppointmentEdited)) Then
			eventManager.SetEnabled(DayViewEventIds.BeforeAppointmentEdited, 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(DayViewEventIds.BeforeAppointmentEdited) Then
			Debug.WriteLine("The BeforeAppointmentEdited event can be fired at this time.")
		Else
			Debug.WriteLine("The BeforeAppointmentEdited 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(DayViewEventGroups.BeforeEvents)) Then
			eventManager.SetEnabled(DayViewEventGroups.BeforeEvents, True)

			eventManager.SetEnabled(DayViewEventGroups.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(DayViewEventIds.BeforeAppointmentResized)) Then
				' ... 
			End If
		End If

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

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

			// Get the UltraDayView'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.
			DayViewEventManager eventManager = this.ultraDayView1.EventManager;


			// Disable the Before/AfterTimeSlotSelectionChanged events
			eventManager.SetEnabled(DayViewEventIds.BeforeTimeSlotSelectionChanged, false);
			eventManager.SetEnabled(DayViewEventIds.AfterTimeSlotSelectionChanged, false);


			// Select the same time slot in the next day.
			// Note: This would normally cause the Before/AfterSelectChange 
			// events to be raised. However, since the above code disabled
			// the events they won't be.
			this.ultraDayView1.PerformAction(UltraDayViewAction.SameTimeSlotNextDay);


			// Re-enable the Before/AfterTimeSlotSelectionChanged events
			eventManager.SetEnabled(DayViewEventIds.BeforeTimeSlotSelectionChanged, true);
			eventManager.SetEnabled(DayViewEventIds.AfterTimeSlotSelectionChanged, 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(DayViewEventIds.BeforeAppointmentEdited))
				eventManager.SetEnabled(DayViewEventIds.BeforeAppointmentEdited, 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(DayViewEventIds.BeforeAppointmentEdited))
				Debug.WriteLine("The BeforeAppointmentEdited event can be fired at this time.");
			else
				Debug.WriteLine("The BeforeAppointmentEdited 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(DayViewEventGroups.BeforeEvents))
				eventManager.SetEnabled(DayViewEventGroups.BeforeEvents, true );

			eventManager.SetEnabled(DayViewEventGroups.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(DayViewEventIds.BeforeAppointmentResized))
			{
				// ... 
			}

		}
参照