Develop a NetLogic that shuts down the host system

Create a NetLogic that
immediately shuts down the host
Windows®
system
on which the
FactoryTalk Optix Application
runs.
Prerequisites
Set the default external code editor. See Set the default code editor.
  1. To develop a NetLogic that shuts down the host system
  2. In
    Project view
    , right-click
    NetLogic
    and select
    New
    Runtime NetLogic
    .
  3. Hover-over the NetLogic, select
    Edit
    , and enter
    ShutDownSystemNetLogic
  4. Double-click the NetLogic.
    The external code editor opens.
  5. 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); } }
  6. Save the code.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.