Event Managers

Some PLF-based controls expose a convenient facility for temporarily disabling their events and for checking if an event is being raised. The following sample code illustrates how it is used.

using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;

private void button2_Click(object sender, System.EventArgs e)
{
    if (this.ultraGrid1.ActiveRow == null)
        return;

    // Get the grid‘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.
    GridEventManager eventManager = this.ultraGrid1.EventManager;

    // Disable the Before/AfterSelectChange events
    eventManager.SetEnabled(GridEventIds.BeforeSelectChange, false);
    eventManager.SetEnabled(GridEventIds.AfterSelectChange, false);

    // Toggle the selection state of the active row.
    // 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.ultraGrid1.ActiveRow.Selected = !this.ultraGrid1.ActiveRow.Selected;

    // Re-enable the Before/AfterSelectChange events
    eventManager.SetEnabled(GridEventIds.BeforeSelectChange, true);
    eventManager.SetEnabled(GridEventIds.AfterSelectChange, 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 disabled.
    if (!eventManager.IsEnabled(GridEventIds.BeforeSelectChange))
        eventManager.SetEnabled(GridEventIds.BeforeSelectChange, true);

    // The grid 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(GridEventIds.BeforeSelectChange))
    {
        // ...
    }

    // The UltraCombo and UltraDropDown controls also expose
    // event managers for their custom events. However,
    // since they have considerably fewer events they don‘t
    // expose overloaded ‘IsEnabled‘ and ‘SetEnabled‘ methods
    // to control groups of events.
    ComboEventManager comboManager = this.ultraCombo1.EventManager;
    comboManager.SetEnabled(ComboEventIds.BeforeDropDown, true);

    DropDownEventManager dropDownManager = this.ultraDropDown1.EventManager;
    dropDownManager.SetEnabled(DropDownEventIds.AfterCloseUp, true);
}
时间: 2024-10-06 09:03:23

Event Managers的相关文章

Event Manager and Event Listener

?? 我已经读完关于事件的文件,看着一对夫妇的教程,但是还有一些我仍然不握.在我见过的Event Managers事件管理器示例,将触发该事件的方法是在同一个class 作为事件管理器.喜欢这个: using UnityEngine; using System.Collections; public class EventManager : MonoBehaviour { public delegate void CheckpointHandler(int id); public static

C#学习日记24----事件(event)

事件为类和类的实例提供了向外界发送通知的能力,实现了对象与对象之间的通信,如果定义了一个事件成员,表示该类型具有 1.能够在事件中注册方法 (+=操作符实现). 2.能够在事件中注销方法(-=操作符实现). 3.当事件被触发时注册的方法会被通知(事件内部维护了一个注册方法列表).委托(Delegate)是事件(event)的载体,要定义事件就的要有委托.  有关委托的内容请点击 委托(De... www.mafengwo.cn/event/event.php?iid=4971258www.maf

GUI & Event例子

Student No.: _______________ Name: ________________________________________1TK2934 Object-Oriented ProgrammingProject : GUI & EventIn this lab you will be using the following Java Swing & awt classes:• container – JFrame, JPanel• components – JBut

13 join 线程锁之Lock\Rlock\信号量 将线程变为守护进程 Event事件  queue队列 生产者消费者模型 Queue队列 开发一个线程池

本节内容 操作系统发展史介绍 进程.与线程区别 python GIL全局解释器锁 线程 语法 join 线程锁之Lock\Rlock\信号量 将线程变为守护进程 Event事件 queue队列 生产者消费者模型 Queue队列 开发一个线程池 进程 语法 进程间通讯 进程池 操作系统发展史 手工操作(无操作系统) 1946年第一台计算机诞生--20世纪50年代中期,还未出现操作系统,计算机工作采用手工操作方式. 手工操作程序员将对应于程序和数据的已穿孔的纸带(或卡片)装入输入机,然后启动输入机把

Linux-hexdump命令调试event驱动—详解(13)

hexdump: 查看文件的内容,比如二进制文件中包含的某些字符串,通常用来调试驱动用 1.调试 键盘驱动 讲解 当我们insmod挂载了键盘驱动后,找到键盘驱动被放在event1设备里, 此时没有按键按下,所以event1里面的数据是没有的,那么数据又是从来哪里来? 通过键盘驱动的read函数,若有按键按下,就会上传按键数据给用户层,此时的用户层就是hexdump 因为键盘驱动的input_handler 是:evdev_handler 所以键盘驱动的read函数是: evdev_handle

Extjs event domain 研究

Listeners and Event Domains In Ext JS 4.2, the MVC event dispatcher was generalized with the introduction of event domains. These event domains intercepted events as they were fired and dispatched them to controllers controlled by selector matching.

MYSQL 定时自动执行EVENT

MySQL从5.1开始支持EVENT功能,类似Oracle和MSSQL的定时任务job功能.有了这个功能之后我们就可以让MySQL自动的执行存储过程来实现数据汇总等功能了,不用像以前哪样手动操作完成了.下面我们来测试下,在MYSQL中如何自动执行指定存储过程,实现相关功能. 一.创建测试表CREATE TABLE EVENT_table(id INT auto_increment PRIMARY KEY NOT NULL,conent VARCHAR(80))ENGINE=INNODB DEFA

Delegate成员变量和Event的区别

上周五有同事问了我一个问题:Delegate和Event有什么区别?具体来说在设计一个类的时候,声明一个事件(Event)和声明一个Delegate类型的成员变量有啥区别. 我的第一反应是没啥区别,虽然从语法看起来不一样,但从代码希望达成的效果来看是一致的,本质都是回调函数.当然区别是肯定有的,我能给我的理由是两个:首先从与COM交互操作时,event对应COM接口中的事件:其次VS的编译环境对定义event提供了更加便捷的支持,可以为其自动生成回调函数的框架. 翻了翻MSDN,并没有直接描述两

如何使用OpenCart 2.x Event事件系统

如何使用OpenCart 2.x Event事件系统 OpenCart 2.x 包含很多新特性,其中之一就是专为开发者提供的事件系统,Event System.它允许你在不修改原有系统代码的基础上( 当然也不使用vQmod或者是2.x版本新增的OCMOD修改代码,这样可以规避代码冲突的风险. ),规定某些特定操作执行的时候,触发特定的动作.比如说:在用户下单或是注册的时候,你可以使用事件系统向后台发送通知信息. 使用原理: 使用事件系统需要两个步骤: 注册事件处理器. 接入事件处理器. 在控制器