The dragonfly software provides an automation interface for integration with applications written
in C# .NET. This interface is accessible by referencing a specific .NET assembly, DragonflyAutomation.dll, in the client project.
Include DragonflyAutomation.dll and DragonflySharedTypes.dll in your C# project and reference
them in the code:
using DragonflyAutomation;
using DragonflySharedTypes;
namespace DragonflyExample
{
public partial class Class1
{
private Dragonfly _dragonfly;
public Class1()
{
_dragonfly = new Dragonfly ();
}
This interface:
- is suitable for loading and running pre-defined protocols.
- is partly asynchronous.
- supports outgoing event interfaces so that client applications can receive notifications of
updates and error conditions.
Wrap code in try-catch blocks in order to catch exceptions.
Integration applications should also subscribe to events e.g.
_dragonflyServer.StatusChanged += _dragonflyServer_StatusChanged
and have an associated method that is called when the event is raised (as defined in your
subscription).
private void _dragonflyServer_StatusChanged(
object sender,
DragonflyAPIStatusChangedEventArgs e
)
{
MachineStatus = e.StatusMessage;
AddToLog(e.StatusMessage);
}
dragonfly automation DLLs
The dragonfly installation installs the DragonflyAutomation.dll into the application directory. To
use the dragonfly automation interface from Visual Studio C#, add a reference to the
DragonflyAutomation.dll and DragonflySharedTypes.dll to your C# project (by selecting Project |
Add Reference, browsing to
C:\Program Files\TTPLabtech\Dragonfly
and selecting DragonflyAutomation.dll and DragonflySharedTypes.dll). The ‘Copy Local’ setting on the referenced assemblies should be set to true.