Search code examples
c#winformsnavisiondynamics-nav

Call method in remote winforms application?


As I've never had reason to do this before, I don't know how to do the following, or if it's even possible?!

I have a C# winforms single instance application (Slave) that has a control on it that displays schedule data using custom .Net controls. The application needs to be opened from DynamicsNAV / Navision (Master) as this can't use the controls being used.

Once the Master opens the Slave app, it needs to pass across a parameter so the Slave can gather the correct data and display it. I know I could pass this as a command line argument, but what we'd really like to do is have it passed into a method so we can update the Slaves Schedule as and when we like. I've already created a public Method in the Slave application, but now I'm stuck as to how I'd open it and call the method. I wanted to get a working example using a Master winforms app, but couldn't get that working either.

Can anyone offer any advice or assitance?

Thanks, Karl


Solution

  • If you are using Dynamics NAV 6 R2 and the Role Tailored Client you can use .NET interop to invoke methods on your WinForms application. If you are using the Classic client you need to implement a COM component to do the same thing.

    In such a scenario, the WinForms app is the 'server' and NAV is the 'client'. You can see an example of how this might work using an IpcChannel here on MSDN.