How to write event (for NA) into .NET Component

M@rtinM@rtin Member Posts: 9
edited 2007-02-07 in Navision Attain
Hi,
I wrote .NET Component (C#), whith event. I tested her in Console application.

Now I want use this component as Automation in Codeunit.
I registred .NET Component with
regasm ...
gacutil ...
..
In Codeunit I see the event 'trigger', but if I Run codeunit function the event trigger is out of action.

Purpose .NET component: Receive mesage from MSMQ. (I need recive messages with several labels. Standard comunication components this can't ).
Question:How to write .NET Class with events witch are work in Navision?

Thanks for all reply
M@rtin

Comments

  • DenSterDenSter Member Posts: 8,307
    I wouldn't even go there. The easiest way would probably be to write a .NET trigger that receives the messages, and puts the label value as a node in the XML of the message, that consequently sends in the message to a non-transactional queue with the right Navision label, and write a codeunit in Navision to retrieve the label value out of it.
  • DosNETsterDosNETster Member Posts: 2
    @DenSter

    Why not "even go there"?
    It is a perfectly legit question, and an issue commonly met by .NET/NAV integrators.

    You might have misunderstood what M@rtin asked...however here's my reply:

    M@rtin, by your ability to see the methods/properties in your DLL from Navision I'm glad to say that you are on the right path.
    You just need to set your interface to InterfaceIsIDispatch, and then do some magic within Navision.
    What we tried was switching single instance on and off in Navision, declaring the object from scratch, and then suddenly out of the blue...it worked.

    I wonder if it is a bug or a feature...hmmmm
  • DenSterDenSter Member Posts: 8,307
    DosNETster wrote:
    @DenSter

    Why not "even go there"?
    Because it is MUCH MUCH easier and quicker to write a little codeunit that runs a MSMQ monitor.
    DosNETster wrote:
    It is a perfectly legit question, and an issue commonly met by .NET/NAV integrators.
    And due to the complexity of a solution like that, they quite commonly charge NAV users much more than they should have to pay for a solution that can be met much more easily with some fairly uncomplicated NAV development.
    DosNETster wrote:
    You might have misunderstood what M@rtin asked...
    No I didn't misunderstand, I actually know what I'm talking about.
  • DosNETsterDosNETster Member Posts: 2
    DenSter wrote:
    No I didn't misunderstand, I actually know what I'm talking about.

    ..and thereby implying that I do not...thanks champ. :)

    Oh, just wanted to add, that occasionally some developers find the need/urge to not be dependent on standard components supplied in the package.

    I didn't mean to get a rise out of you, but if I did...well then you've just made my day. :D
  • DenSterDenSter Member Posts: 8,307
    DosNETster wrote:
    DenSter wrote:
    No I didn't misunderstand, I actually know what I'm talking about.

    ..and thereby implying that I do not...thanks champ. :)
    No I didn't imply anything, I'm just letting you know that I do. I'm sure you know exactly what you are doing as well :mrgreen:
    DosNETster wrote:
    Oh, just wanted to add, that occasionally some developers find the need/urge to not be dependent on standard components supplied in the package.
    What do you mean? The MSMQ object model is not a standard package that is part of NAV. You can program C/AL to use many of the same automation components that you would use in Visual Studio. Many times it is not necessary to create additional external components to accomplish simple things by programming them in NAV directly.
Sign In or Register to comment.