NetLogic templatesΒΆ

Introduction

Depending on design needs, the NetLogic templates described below containing typically useful code are required. Independent of the template, the code contained in a NetLogic can be changed to create any logic, for example:

  • logics related to the life cycle of an object, using the Start and Stop methods

  • new methods

  • other C# logics as desired.

Using directives

Every NetLogic presents a #region in the first row. Inside, Q Studio automatically writes a directive using for each Q Platform module in use in the project. Every directive supplies the C# classes expected by the module.

Important

do not change the directives entered automatically by Q Studio as this could compromise the operation of a NetLogic.

Note

to include third party .NET libraries see Use third party .NET libraries.

Runtime NetLogic structure

Below is a runtime NetLogic template:

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
    }
}

The NetLogic includes two Start and Stop methods in which to write the code to be automatically executed at runtime respectively when the node that contains it is created and removed.

Design time NetLogic structure

Below is the code present in a design time NetLogic template:

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

    }
}

Include a method in which to define the code to execute at design time.

Important

do not change the [ExportMethod] string; it is required to execute the method in Q Studio.