This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ATTENTION: this is not an offcial method and it could be NOT work in future release of FT Optix | |
private void RestartNode(IUANode node) | |
{ | |
if (node is IUAObject nodeObject && node.Status == NodeStatus.Started) | |
{ | |
nodeObject.Stop(); | |
nodeObject.Start(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExportMethod] | |
public void SystemShutDown() | |
{ | |
var psi = new ProcessStartInfo("shutdown", "/s /t 0"); | |
psi.CreateNoWindow = true; | |
psi.UseShellExecute = false; | |
Process.Start(psi); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//RuntimeNetLogic per monitorare l'aggiunta/rimozione degli utenti dalla cartella Security/Users | |
//Il NetLogic può essere posizionato nella cartella NetLogic del progetto | |
//Nell'esempio viene stampato nei log un messaggio ad ogni aggiunta/rimozione di un utente | |
//Utile ad esempio per monitorare l'aggiunta/rimozione di un utente di dominio/windows | |
//L'esempio può essere adattato per sottoscriversi all'aggiunta/rimozione di nodi in qualsiasi cartella di progetto | |
public class CreazioneUtenti : BaseNetLogic | |
{ | |
private IEventRegistration userCreationObserver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var message = LogicObject.GetVariable("Variable1"); | |
//API to find the object type from which is derivated the object instanced in the page | |
var appoggio = Owner.Refs.GetNode(OpcUa.ReferenceTypes.HasTypeDefinition); | |
//API to get the node path in the project's tree | |
message.Value = Log.Node(appoggio); | |
//----Result: | |
//----Root/Objects/NewHMIProject9/UI/Screens/Screen1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExportMethod] | |
public void ModifyRecipeSchema() | |
{ | |
IUAVariable var2 = Project.Current.GetVariable("Model/Variable2"); | |
IUAVariable var3 = Project.Current.GetVariable("Model/Variable3"); | |
RecipeSchema recipeSchema = Project.Current.Get<RecipeSchema>("Recipes/RecipeSchema1"); | |
//creazione e aggiunta variabili nel Recipe Schema EditModel | |
IUAObject editModelObj = recipeSchema.GetObject("EditModel"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExportMethod] | |
public void AllarmiAttivi() | |
{ | |
var retainedAlarmsObject = LogicObject.Context.GetNode(FTOptix.Alarm.Objects.RetainedAlarms); | |
// Get the object containing the actual list of alarms | |
var localizedAlarmsObject = retainedAlarmsObject.GetVariable("LocalizedAlarms"); | |
var localizedAlarmsNodeId = (NodeId)localizedAlarmsObject.Value; | |
IUANode localizedAlarmsContainer = null; | |
if (localizedAlarmsNodeId?.IsEmpty == false) | |
localizedAlarmsContainer = LogicObject.Context.GetNode(localizedAlarmsNodeId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ExportMethod] | |
public void Method1() | |
{ | |
IUAVariable targetVariable = null; | |
try | |
{ | |
targetVariable = InformationModel.GetVariable(LogicObject.GetVariable("VariableToAddChangeMethod").Value); | |
} | |
catch | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Using directives | |
using FTOptix.Core; | |
using FTOptix.HMIProject; | |
using FTOptix.NetLogic; | |
using System.IO; | |
using UAManagedCore; | |
using OpcUa = UAManagedCore.OpcUa; | |
#endregion | |
public class BlinkerCreator : BaseNetLogic { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private PeriodicTask task; | |
public override void Start() | |
{ | |
task = new PeriodicTask(CheckUSB, 1000, LogicObject); | |
task.Start(); | |
} | |
private void CheckUSB() | |
{ |
NewerOlder