Custom

From VASCO
Jump to navigation Jump to search

The custom plugin enables customers to define their own input field and KPIs.

Usage

Custom input fields and calculated fields can be defined using C# notation.

Input Fields

The Property attributes requires the following:

  • Unique Name of the property
  • Namespace of the plugin (has to be "Custom")
  • Datatype (see input types below)
  • Unit
  • Default value

The following input types are supported:

  • string
  • double
  • VascoTimeSpan


The PropertyDialog attribute specifies has the field is presented in the user interface (usually the PropertyDialog):

  • Label
  • Category
  • CategoryOrder
  • ProeprtyOrder

Calculated Fields

Example

The following snippet snippet shows the double input field (SimpleDoubleInput), which is used in SimpleDoubleSquare to calculate its square value.


[Property("SimpleDoubleInput", "Custom", "double", "", DefaultValue = "3.14")]
[PropertyDialog("Simple String", "Input", CategoryOrder = 1, PropertyOrder = 1)]
internal class ExamplePlugin_SimpleStringInput
{
}


[Property("SimpleDoubleSquare", "Custom", "double", "", DefaultValue = "0.0")]
[PropertyDialog("SimpleDoubleSquare", "General", CategoryOrder = 13, PropertyOrder = 2)]
internal class ExamplePlugin_SimpleDoubleSquare : PropertyCalculation
{
    public override void Graph(IValueStream GC, IModelBase m, string nameSpace)
    {
        INIT(GC, m, nameSpace);

        var ds = GetGlobalProperty("Custom", "SimpleDoubleInput");

        SetGraphCalculation(m,() =>
        {
            CalcSetValue(m,(double)ds.ObjValue * (double)ds.ObjValue);
        });
    }
}