开发者

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 (S开发者_如何转开发lave) 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


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.


Yes you can do this - typically this is referred to as "inter process communication".

There are many available methods, but as long as you are using .Net 3.5 or later you should probably be using WCF (Windows Communication Foundation) for this. There are many guides and introductions to WCF available on the internet.

If you are using a version of .Net prior to 3.5 then look into .Net remoting.


What about sending the data in any form (command arguments, a file, TCP/IP socket, whatever), parsing the data and calling the command you've created with the arguments created from the parting?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜