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);
}

Event Managers的更多相关文章

  1. ARTIFICIAL INTELLIGENCE FOR GAMES (Ian Millington / John Funge 著)

    相关网站:http://www.ai4g.com PART I AI AND GAMESCHAPTER1 INTRODUCTIONCHAPTER2 GAME AIPART II TECHNIQUESC ...

  2. GUI & Event例子

    Student No.: _______________ Name: ________________________________________1TK2934 Object-Oriented P ...

  3. python网络编程-进程间数据通信(Queue,Pipe ,managers)

    一:进程间数据交换方法 不同进程间内存是不共享的,要想实现两个进程间的数据交换,可以用以下方法: Queue,Pipe ,managers 1)Queue,使用方法跟threading里的queue差 ...

  4. Storm-源码分析-EventManager (backtype.storm.event)

    Protocol and DataType 大体结构, 定义protocol EventManager, 其实就是定义interface 函数event-manager, 主要做2件事 1. 启动ev ...

  5. UI Framework-1: Aura Layout Managers

    Layout Managers LayoutManager is a convenient abstraction that separates messy layout heuristics fro ...

  6. 如何利用ETW(Event Tracing for Windows)记录日志

    ETW是Event Tracing for Windows的简称,它是Windows提供的原生的事件跟踪日志系统.由于采用内核(Kernel)层面的缓冲和日志记录机制,所以ETW提供了一种非常高效的事 ...

  7. [.NET] C# 知识回顾 - Event 事件

    C# 知识回顾 - Event 事件 [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/6060297.html 序 昨天,通过<C# 知识回顾 - ...

  8. Atitit 解决Unhandled event loop exception错误的办法

    Atitit 解决Unhandled event loop exception错误的办法 查看workspace/.metadata/.log org.eclipse.swt.SWTError: No ...

  9. Java模拟Windows的Event

    场景 开发中遇到一个场景,业务操作会不定时的产生工作任务,这些工作任务需要放入到一个队列中,而另外会有一个线程一直检测这个队列,队列中有任务就从队列中取出并进行运算. 问题 业务场景倒是简单,只不过这 ...

随机推荐

  1. PAT-乙级-1011. A+B和C (15)

    1011. A+B和C (15) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 HOU, Qiming 给定区间[-231, 231 ...

  2. State Management

    Samza的task可以把数据进行本地存储,并且对这些数据进行丰富的查询.   比较SQL中的select ... where...并不需要保存状态.但是aggregation和join就需要存储ro ...

  3. static 内部类

    一般情况下是不可以用static修饰类的.如果一定要用static修饰类的话,通常static修饰的是匿名内部类. 在一个类中创建另外一个类,叫做成员内部类.这个成员内部类可以静态的(利用static ...

  4. 修改MYSQL数据库表的字符集

    MySQL 乱码的根源是的 MySQL 字符集设置不当的问题,本文汇总了有关查看 MySQL 字符集的命令.包括查看 MySQL 数据库服务器字符集.查看 MySQL 数据库字符集,以及数据表和字段的 ...

  5. mac 用 brew

    mac 下用   brew 安装插件, 有重复的不会再次安装,比xmap模式好

  6. *[topcoder]GUMIAndSongsDiv1

    http://community.topcoder.com/stat?c=problem_statement&pm=12706&rd=15700 这题有意思.首先要观察到,如果选定一些 ...

  7. 将 Qt 5.6 集成至 VS2015

    摘要: 由于VS2015不再支持addin,所以要用其他手段. 这里给出64位系统下的安装步骤,32位类似. 一.安装VS2015 过程略.值得注意的是要选择需要安装的内容,既然要用Qt,那么C++相 ...

  8. node.js 模块和包

    Node.js 的模块和包机制的实现参照了 CommonJS 的标准,但并未完全遵循.不过两者的区别并不大,一般来说你大可不必担心,只有当你试图制作一个除了支持 Node.js之外还要支持其他平台的模 ...

  9. Zookeeper运维经验

    转自:http://www.juvenxu.com/2015/03/20/experiences-on-zookeeper-ops/ ZooKeeper 是分布式环境下非常重要的一个中间件,可以完成动 ...

  10. grunt安装中的cli和--save-dev解释

    grunt官网安装grunt的介绍中是这么写的: npm install -g grunt-cli 这里安装Grunt的命令行支持(command line interface,简称CLI),在这之后 ...