调用委托时NotImplementedException

Qi *_*hen 3 c# delegates winforms

我正在实现一个事件结构,以将信息从View传递给Presenter.在视图中,单击按钮时会调用以下代码:

private void alterCmpd1()
{
    EventHandler AlterEvent = AlterCompound1_Action;
    if (AlterEvent != null) AlterEvent(this, EventArgs.Empty);
}

public event EventHandler AlterCompound1_Action;
Run Code Online (Sandbox Code Playgroud)

出于某种原因,NotImplementedException总是出现在:

AlertEvent(this, EventArgs.Empty);
Run Code Online (Sandbox Code Playgroud)

有人可以帮我找出原因吗?

来自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.
    }
Run Code Online (Sandbox Code Playgroud)

小智 5

90%的确定,如果你看起来你会发现这一点.

private void AlterCompound1_Action(object, EventArgs e)
{
    throw new NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)