/// <summary> /// Stop the running script /// </summary> public void Stop() { // Do NOT call Stop() from the ScriptThread // Instead, throw a ScriptStoppedException ScriptThread.Abort(); ScriptThread = null; // calling this event is not necessary because thread aborts cause // ThreadAbortException to be thrown on ScriptThread, thus triggering // the event // OnScriptStopped(new ScriptStoppedEventArgs()); }