LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

register event callbacks through .NET nodes

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.

0 Kudos
Message 1 of 5
(2,399 Views)

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.

 

 

George Zou
0 Kudos
Message 2 of 5
(2,379 Views)

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.

0 Kudos
Message 3 of 5
(2,366 Views)

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).

0 Kudos
Message 4 of 5
(2,325 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(2,319 Views)