本文介绍了运行事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个事件,例如:
私有无效测试(对象发送者,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()); }我希望这会有所帮助,但可能是我弄错了您要怎么做... 这也可能会有所帮助: msdn.microsoft/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: msdn.microsoft/en-us/library/aa720046%28v=vs.71%29.aspx
更多推荐
运行事件
发布评论