Overview
Custom Transformation Plugins - Overview
IMPORTANT: Developing custom plugins as described in this section involves the use of Microsoft's Visual Studio integrated development environment (IDE) for Windows. It is not recommended for anyone who is unfamiliar with Visual Studio, C# Development, or object orientated programming.
Transformations for TagsCollector are implemented as plugins. Each transformation is created as its own project and compiled into a .dll file. All the transformation .dll files are placed in a single directory. From this directory, TagsCollector and TagsCollectorService load these assemblies into their programs. Each project must contain all the necessary references and class decorations. A template is available to assist in the creation of such a plugin.
A wide range of possibilities exists for creating a transformation. Most commonly, transformations are used to change the text or color output and the alarm state of the tag. More advanced uses include the use of other tags to determine whether an alarm is shown.
There are some basic functions shared by all transformations that should be kept intact when creating a plugin. Aside from the interface methods that must be implemented, the way transformations are loaded and saved should be consistent for clean operation.
Each Transformation has two parts: An Editor UI for creating and editing the transformations (TagsCollector) and a code file that transforms the tags in the background while the service is running (TagsCollectorService).
As can be seen in the image below, there is an EditTransformationTemplate.cs and TransformationTemplate.cs inside the TransformationTemplate solution. The EditTransformationTemplate.cs is the UI that will appear in the TagsCollector when a user selects the transformation from the dropdown menu. TransformationTemplate.cs is the code that executes within the TagsCollectorService to transform the tags.
There are two other classes in the template: ErrorLog.cs and Global.cs. ErrorLog.cs is a logger class that logs errors to the directory of your specification. Global.cs contains data that is used in both EditTransformationTemplate.cs and TransformationTemplate.cs.
The following sections demonstrate the creation of a transformation plugin from start to finish. General guidelines are provided for creating a transformation that works seamlessly with the TagsCollector application.