Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NotImplementedException when calling delegate [closed]

I am implementing an event structure to pass information from a View to a Presenter. In the view, the following code is called when a button is clicked:

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

public event EventHandler AlterCompound1_Action;

For some reason, a NotImplementedException always appears on:

AlertEvent(this, EventArgs.Empty);

Could someone help me figure out why?

Code from Presenter class:

    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.
    }
like image 264
Qi Chen Avatar asked Jul 15 '26 06:07

Qi Chen


2 Answers

90% sure if you look you'll find this.

private void AlterCompound1_Action(object, EventArgs e)
{
    throw new NotImplementedException();
}

Thanks to Will, I realized the mistake I was making. I had been using the "Build Solution" tool, but I neglected to look in the Build Configuration Manager for Visual Studio 2010 (Build -> Configuration Manager). There, I found this:

Screenshot of configuration manager in VS2010

Before, some of those Build column check marks (corresponding to the projects that I was editing, such as QAz.Presenter and QAz.View) were not selected, so "Build Solution" was skipping over them. After those projects were selected, Visual Studio knew to build them when I ran the solution.

like image 42
Qi Chen Avatar answered Jul 17 '26 19:07

Qi Chen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!