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. spoj 1437

    自己暴了一下不过     转一个 bfs... #include <cstdio> #include <vector> #include <queue> #incl ...

  2. 用CodeViz绘制函数调用关系图(call graph)

    CodeViz是<Understanding The Linux Virtual Memory Manager>(at Amazon,下载地址在页尾)的作者 Mel Gorman 写的一款 ...

  3. android 动态改变listview的内容

    本文模拟:点击一个按钮,为已有的listview添加一行数据 <?xml version="1.0" encoding="utf-8"?> < ...

  4. 到底该不该熟悉掌握struts2的ONGL呢?

    其实,在学习网站开发过程中,其实不掌握ONGL也是可以的.我们完全可以使用JSTL和EL来代替OGNL. 只要存在要往页面传输内容,我们直接把对象放在request范围即可,这样我们就可以在jsp中使 ...

  5. Top命令内存占用剖析

    原文: http://yalung929.blog.163.com/blog/static/203898225201212981731971/ 引 言: top命令作为Linux下最常用的性能分析工具 ...

  6. Java SE7新特性之try-with-resources语句

       try-with-resources语句是一个声明一个或多个资源的 try 语句.一个资源作为一个对象,必须在程序结束之后随之关闭. try-with-resources语句确保在语句的最后每个 ...

  7. Linux下的动态连接库及其实现机制

    Linux与Windows的动态连接库概念相似,但是实现机制不同.它引入了GOT表和PLT表的概念,综合使用了多种重定位项,实现了"浮动代码",达到了更好的共享性能.本文对这些技术 ...

  8. Linux的分段和分页机制

    1.分段机制 80386的两种工作模式  80386的工作模式包括实地址模式和虚地址模式(保护模式).Linux主要工作在保护模式下. 分段机制  在保护模式下,80386虚地址空间可达16K个段,每 ...

  9. 【一】 sched.h

    第一个数据结构体是 task_struct ,这个数据结构被内核用来表示进程,包含其所有信息. 定义于文件 include/linux/sched.h 中,先看看其完整定义 struct task_s ...

  10. php简陋版实现微信公众号主动推送消息

    推荐一个网站www.itziy.com csdn免积分下载器.pudn免积分下载器.51cto免积分下载器www.verypan.com 百度网盘搜索引擎www.94cto.com 编程相关视频教程. ...