Develop a NetLogic that shuts down the host system
Create a NetLogic that
immediately shuts down the host operating system
on which the FactoryTalk Optix Application
runs.Prerequisites
Set the default external code editor. See Set the default code editor.
- InProject view, right-clickNetLogicand select .
- Hover-over the NetLogic, select , and enterShutDownSystemNetLogic
- Double-click the NetLogic.The external code editor opens.
- Replace the existing code with the following code:#region StandardUsing using System; using FTOptix.Core; using FTOptix.CoreBase; using FTOptix.HMIProject; using UAManagedCore; using OpcUa = UAManagedCore.OpcUa; using FTOptix.NetLogic; using FTOptix.OPCUAServer; using FTOptix.UI; using System.Diagnostics; #endregion public class ShutDownSystemNetLogic : FTOptix.NetLogic.BaseNetLogic { [FTOptix.NetLogic.ExportMethod] public void SystemShutDown() { var psi = new ProcessStartInfo("shutdown", "/s /t 0"); psi.CreateNoWindow = true; psi.UseShellExecute = false; Process.Start(psi); } }
- Save the code.
Provide Feedback