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.
  1. In
    Project view
    , right-click
    NetLogic
    and select
    New
    Runtime NetLogic
    .
  2. Hover-over the NetLogic, select
    Edit
    , and enter
    ShutDownSystemNetLogic
  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.