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 theStartandStopmethods
- New methods
- Other C# logics
using directives
using
directivesEvery 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.
TIP:
If adding a third-party library, see:
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 aNetLogicfolder): TheStartmethod runs when the runtime starts.
- NetLogic as descendent of a UI Type: TheStartmethod 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 aNetLogicfolder): TheStopmethod runs when the application runtime stops.
- NetLogic as descendent of a UI type: TheStopmethod 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. Provide Feedback