Create a NetLogic

Develop a design-time NetLogic that creates localized labels.
Prerequisites
Set the default external code editor. See Set the default code editor.
  1. To create a NetLogic
  2. In
    Project view
    , right-click
    MainWindow (type)
    and select
    New
    Design-time NetLogic
    .
  3. Hover-over
    DesignTimeNetLogic1
    , select
    Edit
    , and enter
    CreateLocalizedLabels
  4. Double-click the NetLogic.
    The external code editor opens.
  5. In the code editor, edit
    public void Method1()
    as follows:
    [ExportMethod] public void Method1() { String labelName = "
    MyLabelName
    "; Label myLabel = Owner.Get<Label>(labelName); if (myLabel == null ) { myLabel = InformationModel.Make<Label>(labelName); myLabel.LocalizedText = new LocalizedText(myLabel.NodeId.NamespaceIndex, "
    myKey1
    "); Owner.Add(myLabel); } else { Log.Warning("Label with name " + labelName + " already exists"); } }
  6. Save the code.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.