2 Replies Latest reply on Jan 25, 2010 4:11 PM by spilon

    PB add-in events not firing

    mhalhead

      This is probably me being daft. But I can't figure it out. It appears that the events of my PB add-in aren't firing. I've created a docked window add-in using the VS2005 template. Based on the post for using the designer to create the ID I've include the creation of the view in the Show event. However, it does not run; if I call the method from the OnConnection method then it runs no problems. I've also had the same problem with the DisplayActivate method. I have absolutely no idea how to fix this.

       

      I attached the code as a txt file; I wasn't able to post it into the message with an acceptable format as all the advanced functions kept throwing a js error.

        • Re: PB add-in events not firing
          mhalhead

          Okay I was being stupid. C# as I should know does not have a WithEvents operator (unlike VB) you have to wire up the exceptions in the code. So the question now is the code below the best option (in the OnConnection method)?

           

          m_theApp.DisplayActivate += this.DisplayActivate;

           

           

            • Re: PB add-in events not firing

              Yes, this is the right approach in C#.

               

              One special case you need to pay attention to is with the PI SDK events - because the PI SDK is originally a COM set libraries and you use it .NET by means of interop assemblies. This means you need to go through "event dispatch interfaces" and method delegates. Please do not hesitate to post your questions on the "PI SDK Development" discussion forum if you need assistance with any of that.