05-20-2014 05:23 PM
Hello
I currently have a windows service application that is publishing custom .NET events and I would like to receive them in a labview application. I tried to do this through LabVIEW by using the available .NET nodes, but seemed to hit a road block when trying to find GetCallbackChannel<CustomTemplateType>(); function within the OperationContext.Current method.
Should I be doing this a different way?
Thanks InAdvance.
05-20-2014 06:19 PM
Take a look this example:
C:\Program Files (x86)\National Instruments\LabVIEW 2013\examples\Connectivity\Dot NET\Passing Data to a .NET Event Callback.vi
You can always use the Example Finder to find examples on your computer.
05-20-2014 10:05 PM
Hi Zou,
I looked at those examples, but I'm not seeing the relationship between the those examples and the problem I'm having.
For example in my C# code I have a method callback that get executed by the following method, OperationContext.Current.GetCallbackChannel<CustomTemplateType>. If I want to do this in LabVIEW I figured that I should be using the System.ServiceModel.OperationContext.Current object. I am simply trying to mirror in LabVIEW what I did in my C# code. Am I missing something?
Thanks Again.
05-21-2014 01:52 PM
Can you post the C# code you are trying to duplicate in LabVIEW?
That said, I'm not sure you can get this working in pure LabVIEW, because there is no support for .NET generics (as in your CustomTemplateType).
05-21-2014 02:17 PM
LabVIEW does not support generics as nathand already mentioned. For normal .Net objects that use generics you can work around that by something called reflection. An example is discussed here. The whole method is however quite involved and somewhat magic. I'm however not sure that would work with events as there you don't generate the object but rather receive it and simply have to provide the correct refnum type for LabVIEW to work with.
The only other solution is to write a wrapper that translates the generic interface into an explicit interface.