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. Bypass Preventing CSRF

    CSRF在过去的n年(n>2)一直都火,在bh/defcon/owasp等会议上多次探讨CSRF的攻防[具体你可以看看以往的那些pp].前 段时间PLAYHACK.net上发表了一个总结性的pp ...

  2. 时序列数据库武斗大会之 TSDB 名录 Part 1

    [编者按] 刘斌,OneAPM后端研发工程师,拥有10多年编程经验,参与过大型金融.通信以及Android手机操作系的开发,熟悉Linux及后台开发技术.曾参与翻译过<第一本Docker书> ...

  3. VARCHAR2转换为CLOB碰到ORA-22858错误

    近日工作中发现有一张表的字段类型建错了,本应是BLOB类型却被别人建成了VARCHAR2(200),修改时oracle却提示“ORA-22858 invalid alteration of datat ...

  4. pthread_create()之前的属性设置

    一.pthread_create()之前的属性设置1.线程属性设置我们用pthread_create函数创建一个线程,在这个线程中,我们使用默认参数,即将该函数的第二个参数设为NULL.的确,对大多数 ...

  5. php的redis 操作类,适用于单台或多台、多组redis服务器操作

    redis 操作类,包括单台或多台.多组redis服务器操作,适用于业务复杂.高性能要求的 php web 应用. redis.php: <?php /* redis 操作类,适用于单台或多台. ...

  6. 关于PYTHON的反射,装饰的练习

    从基本概念,简单例子才能慢慢走到高级一点的地方. 另外,PYTHON的函数式编程也是我很感兴趣的一点. 总体而言,我觉得OOP可以作大的框架和思路,FP能作细节实现时的优雅牛X. ~~~~~~~~~~ ...

  7. android 从系统相册获取一张图片

    package net.viralpatel.android.imagegalleray; import android.app.Activity; import android.content.In ...

  8. HDU4857——逃生(反向建图+拓扑排序)(BestCoder Round #1)

    逃生 Description 糟糕的事情发生啦,现在大家都忙着逃命.但是逃命的通道很窄,大家只能排成一行. 现在有n个人,从1标号到n.同时有一些奇怪的约束条件,每个都形如:a必须在b之前.同时,社会 ...

  9. POJ3083——Children of the Candy Corn(DFS+BFS)

    Children of the Candy Corn DescriptionThe cornfield maze is a popular Halloween treat. Visitors are ...

  10. POJ3278——Catch That Cow(BFS)

    Catch That Cow DescriptionFarmer John has been informed of the location of a fugitive cow and wants ...