运行事件 [英] run event

查看:95
本文介绍了运行事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个事件,例如:

私有无效测试(对象发送者,AutomationEventArgs e)

private void test(object sender,AutomationEventArgs e)

{

int a = 10;

int a=10;

a + = 10;

a+=10;

}

现在我希望关闭此事件后,我可以说运行一些事件

now i want that after close this event i can say run some events

怎么做;

请帮助我,很紧急

 

推荐答案

您可以调用一个事件:

public event EventHandler MyEvent;

protected virtual void OnEvent(EventArgs e) {
var eh = this.MyEvent;
 if (eh != null) { eh(this, e); } }

private void test(object sender,AutomationEventArgs e) { int a=10; a+=10; this.OnEvent(new EventArgs()); }

我希望这会有所帮助,但可能是我弄错了您要怎么做...


这也可能会有所帮助: http://msdn.microsoft.com/zh-cn/library/aa720046%28v=vs.71%29.aspx

I hope this is helpful, but may be I got it wrong what your are going to do...


This may be helpful too: http://msdn.microsoft.com/en-us/library/aa720046%28v=vs.71%29.aspx


这篇关于运行事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆