cdietschrun
cdietschrun

Reputation: 1683

Does not implement interface member Error

Here's my code, VS2012 C# Express is complaining about the non implementation of the two members in the interface PISDK._DEventPipeEvents, which is pasted here quickly:

    namespace PISDK
{
    [Guid("9E679FD2-DE8C-11D3-853F-00C04F45D1DA")]
    [InterfaceType(2)]
    [TypeLibType(4096)]
    public interface _DEventPipeEvents
    {
        [DispId(2)]
        void OnNewValue();
        [DispId(1)]
        void OnOverflow(object vtEvent, OverflowCauseConstants Cause);
    }
}

and here's my code:

class PointListEventPipeEventReceiver : PISDK._DEventPipeEvents
{
    private PISDK.EventPipe eventPipe;

    public PointListEventPipeEventReceiver(PISDK.EventPipe eventPipe)
    {
        this.eventPipe = eventPipe;
    }

    public void PISDK._DEventPipeEvents.OnNewValue()
    {
        Console.WriteLine("New value event");
        handleNewValue(eventPipe);
    }

    public void PISDK._DEventPipeEvents.OnOverFlow(object vtEvent, PISDK.OverflowCauseConstants Cause)
    {
        throw new NotImplementedException();
    }

    private void handleNewValue(PISDK.EventPipe eventPipe)
    {
        Console.WriteLine("Handling new value");
        Array eventObjs = eventPipe.TakeAll();
        Console.WriteLine("eventObjs.Length==" + eventObjs.Length);
        foreach (PISDK.PIEventObject piEventObj in eventObjs)
        {
            Console.WriteLine(piEventObj.EventData as PISDK.PointValue);
        }
    }
}

I'm at a loss here, any help is nice.

Upvotes: 3

Views: 22247

Answers (2)

phoog
phoog

Reputation: 43066

In addition to getting the case wrong in "overflow", it looks like you're trying to apply the public access modifier to an explicit interface member implementation. You can either implement the member implicitly as a public member, or explicitly, but not both.

Implicit implementation:

public void OnOverflow(object vtEvent, PISDK.OverflowCauseConstants Cause) 
{ 
    throw new NotImplementedException(); 
} 

Explicit implementation:

void PISDK._DEventPipeEvents.OnOverflow(object vtEvent, PISDK.OverflowCauseConstants Cause) 
{ 
    throw new NotImplementedException(); 
} 

Upvotes: 4

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 727047

Your implementation uses OnOverFlow with a capital F instead of a lowercase one in the interface. The method should be called OnOverflow.

Upvotes: 5

Related Questions