gpt4 book ai didi

c# - 调用委托(delegate)时出现 NotImplementedException

转载 作者:行者123 更新时间:2023-11-30 14:35:35 25 4
gpt4 key购买 nike

<分区>

我正在实现一个事件结构以将信息从 View 传递到演示者。在 View 中,单击按钮时将调用以下代码:

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.
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com