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
Set the default external code editor. See Set the default code editor.
  1. In
    Project view
    , right-click
    and select
    Runtime NetLogic
  2. Hover-over the NetLogic, select
    , and enter
  3. Double-click the NetLogic.
    The external code editor opens.
  4. 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); } }
  5. Save the code.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.