NetLogic templates

You must use the NetLogic templates to make the code operational.

The code contained in a NetLogic can be changed to create any logic, such as:
  • Logic related to the lifecycle of an object, using the Start and Stop methods

  • New methods

  • Other C# logics

using directives

Every NetLogic presents a #region in the first row. FactoryTalk Optix Studio automatically writes a directive using each FTOptix module in the project. Every directive supplies the C# classes expected by the module.
Important: Do not change the directives entered automatically by FactoryTalk Optix Studio as this could compromise the operation of a NetLogic.

Runtime NetLogic template

The NetLogic template includes the Start() and Stop() methods used to insert the code to run automatically at runtime.

The methods are triggered in this way:
Start() method
The method runs when the object where the method was created starts to exist.
  • NetLogic in non-UI Type (for example, in a NetLogic folder): The Start method runs when the runtime starts.

  • NetLogic as descendent of a UI Type: The Start method runs when the graphical object is rendered in any session of any PresentationEngine.

Stop() method
The method runs when the object where the method was created gets disposed.
  • NetLogic in non-UI type (for example, in a NetLogic folder): The Stop method runs when the application runtime stops.

  • NetLogic as descendent of a UI type: The Stop method runs when the UI type is disposed in any session of any PresentationEngine (for example, when switching to a different page).


public class NetlogicName : BaseNetLogic
{
    public override void Start()
    {
         // Insert code to be executed when the user-defined logic is started
    }

    public override void Stop()
    {
        // Insert code to be executed when the user-defined logic is stopped
    }
}

Design time NetLogic template

This NetLogic template includes a method for inserting the code to execute at design time.

public class NetlogicName : BaseNetLogic
{
    [ExportMethod]
    public void NetlogicNameMethod()
    {

    }
}
Important: Do not change the [ExportMethod] string. The string is required to execute the method.