This is causing headache, the event OnGetStatusEvent is never fired...
I know it has to do with the fact it's encapsulated inside class.
The Event is a method of a com object, I did not implement it myself...
The following code always work if inside a windows or console application.
Please help me to understand how I could declare the event differently so it gets fired when GetStatus is finished.

public class TestClass : EventArgs, IDVR
    {
        public newSOMELIB.RemoteEnt myNtObj;

string IDVR.getStatus(string strIP)
        {
            myNtObj.GetStatus(answerBack);
            myNtObj.OnGetStatusEvent+=newSOMELIB._NTRemoteEvents_OnGetStatusEventEventHandler(myNTObj_OnGetStatusEvent);
            return "something";
        }

        void myNtObj_OnGetStatusEvent(int lSessionID, string eReason, string pIUnitStatus)
        {
           // This Never Get Fired !!!!!!!
            throw new NotImplementedException();
        }

Thanks, I'll be refreshing....

I feel very stupid..... 2 things,
the delegate is declared after the call AND it's called from a console application and the event doesn't have time to get executed before programe termination.

I know create the instance clicking the button of a form, and everything works....

Time for a coffee. I actually wrote back what went wrong, It might help somone one day who went to bed too late... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.