public static void SetCodeThread1(string code, ParserExceptionEvent exReturn = null, LineChangeEvent evNewLine = null) { if (Thread_1_Obj == null) { Thread_1_Obj = new Function("MAIN", code); //Clear Parser Exception event Thread_1_ParserException -= Thread_1_ParserException; //Assign new Event Thread_1_ParserException += exReturn; Thread_1_LineChangeEvent -= Thread_1_LineChangeEvent; Thread_1_LineChangeEvent += evNewLine; } else { throw new Exception("Wait for program to end! Then start a new one!"); } }