LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Register C# listeners to LabVIEW Control Events

I developed a C# WinForms App using ActiveX Automation to pass values from C# WinForms App to my Arduino LabVIEW VI file (2019 SP1 Labview). The App works ok, but How can I create any listeners from my C# WinForms App to be trigered when a LabView control change for example:

 

1) When I load the VI file from WinForms C# I passed the Serial Port and the Digital Input to be triggered to Labview and execute the Run Asyncrously,  but I must to wait some seconds for Labview connection to my Arduino device.

 

My question is:

How can I create a listener in C#  to be triggered when the Labview was connected to my Arduino Device?, in the VI I have a string indicator with the Hz connection, is possible attached for example a onChange event for this labview indicator and pass this event to my C# WinForms App?

 

I attached the sources of my C# App with the labview used to be tested.

 

Regards

0 Kudos
Message 1 of 2
(1,872 Views)

I don't think that is easily possible with OoTB LabVIEW functionality. You might be able to wait for a user event. But even if that is possible, it will rely on unmanaged API calls.

 

If you want this, you'll have to make it yourself.

 

You should be able to create a .NET object (maybe an EventWaitHandle?). You could do that in either LabVIEW (and pass to .NET) or in the assembly (and pass to LabVIEW). Then trigger that .NET object at will with .NET methods.

 

This does mean you need to glue the events together in LabVIEW: each .NET event is triggered in a LabVIEW event. You could look into LabVIEW's Callback events. You can start them dynamically, and they are a bit less intrusive on the rest of the LabVIEW program, compared to adding events in an event structure.

 

It might be easier to just start the .NET code yourself in the event. The event mechanism might just complicate things.

0 Kudos
Message 2 of 2
(1,854 Views)