11-22-2015 12:57 PM
I'd like to be able to handle the events (documentation says it just tells us when we start/stop sampling and other things of that nature) in the application, so I think they do need to be exposed. To be honest though, I would be happy just being able to create an instance of the PropEngine with an empty/null/identity handler.
I've tried writing the wrapper myself, using all sort of combinations of private/public,static and not static, EventHandler and EventHandler<PropEventArgs>, etc, but to no avail. If you could show me what such a wrapper would look like, I'd really appreciate it.
11-22-2015 01:26 PM - edited 11-22-2015 01:27 PM
LabVIEW doesn't manage generics well so my advice is to create a basic delegate and event similar to below. In your wrapper class, call the event when the function is called
public delegate void PropEngineDelegate(object sender, PropEngineEventArgs args);
public event PropEngineDelegate Changed;
private void PropEngineEventHandlerFunc(object sender, PropEngineEventArgs eventArgs) { if (Changed != null)
{
Changed(sender, eventArgs);
} }
... In your constructor of the wrapper class
// Create the PropEngine _propEngine = new PropEngine(PropEngineEventHandlerFunc);
This way when the PropEngine API calls your attached callback funciton you fire a public event that the caller can access. In LabVIEW you can register for the event and supply a callback VI (or rather - let LabVIEW create it for you).