我正在实现一个事件结构来将信息从视图传递给演示者。在视图中,单击按钮时会调用以下代码:
private void alterCmpd1()
{
EventHandler AlterEvent = AlterCompound1_Action;
if (AlterEvent != null) AlterEvent(this, EventArgs.Empty);
}
public event EventHandler AlterCompound1_Action;
出于某种原因,NotImplementedException 总是出现在:
AlertEvent(this, EventArgs.Empty);
有人可以帮我弄清楚为什么吗?
Presenter 类的代码:
public MainPresenter(IMainView view, IModel model)
{
this.view = view;
this.view.AlterCompound1_Action += new EventHandler(view_AlterCompound1);
this.model = model;
view.Show();
}
void view_AlterCompound1(object sender, EventArgs e)
{
// I commented out this code, on the off
// chance that it was affecting things. Still no luck.
}