public void TestScriptAbort() { if (_testScriptThread == null || _testScriptThread.ThreadState != Thread.eThreadStates.ThreadRunning) { throw new Exception("Script not running"); } _testScriptThread.Abort(); }
public static void ListenForUpdateServers() { if (_udpServer != null) { return; } _udpServer = new UDPServer(IPAddress.Any, 15000, 1000); _udpServer.EnableUDPServer(); CrestronEnvironment.ProgramStatusEventHandler += type => { _programStopping = type == eProgramStatusEventType.Stopping; if (!_programStopping) { return; } try { _udpServer.DisableUDPServer(); _udpServer.Dispose(); } catch (Exception e) { CloudLog.Exception(e); } if (_listenThread.ThreadState == Thread.eThreadStates.ThreadRunning) { _listenThread.Abort(); } }; _listenThread = new Thread(ProcessUdpData, null) { Name = "Software Update Listener" }; }