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.
- To create a NetLogic
- InProject view, right-clickMainWindow (type)and select .
- Hover-overDesignTimeNetLogic1, select , and enterCreateLocalizedLabels
- Double-click the NetLogic.The external code editor opens.
- In the code editor, editpublic 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"); } }
- Save the code.
Provide Feedback