Exemplo n.º 1
0
        protected static void Thread_1_Handle()
        {
            State_1 = ScriptThreadState.Waiting;
            while (true)
            {
                //Warte bis ein object an den Thread übergeben wird
                while (Thread_1_Obj == null)
                {
                    Thread.Sleep(1);
                }

                State_1 = ScriptThreadState.Running;

                Function local = null;
                lock (Thread_1_Obj)
                {
                    local = Thread_1_Obj;
                }

                Thread_1_LocalNode = local.GetFunctionNode(new List <Node>(), true);
                Thread_1_LocalNode.ScriptThreadID = 1;

                bool b = false;
                try
                {
                    Thread_1_LocalNode.Evaluate(out b);
                }
                catch (Exception ex)
                {
                    if (ex.GetType() == typeof(ParserException))
                    {
                        Console.WriteLine(ex.Message);
                        if (Thread_1_ParserException != null)
                        {
                            Thread_1_ParserException((ParserException)ex);
                        }
                        Thread_1_ParserException -= Thread_1_ParserException;
                    }
                }
                Thread_1_LocalNode.Clean();

                local.Clear();
                lock (Thread_1_Obj)
                {
                    Thread_1_Obj = null;
                }

                State_1 = ScriptThreadState.Waiting;
                //Warte am ende 1ms
                Thread.Sleep(1);
            }
        }
Exemplo n.º 2
0
        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!");
            }
        }
Exemplo n.º 3
0
        protected static void Thread_1_Handle()
        {
            State_1 = ScriptThreadState.Waiting;
            while (true)
            {
                //Warte bis ein object an den Thread übergeben wird
                while (Thread_1_Obj == null)
                    Thread.Sleep(1);

                State_1 = ScriptThreadState.Running;

                Function local = null;
                lock (Thread_1_Obj)
                {
                    local = Thread_1_Obj;
                }

                Thread_1_LocalNode = local.GetFunctionNode(new List<Node>(), true);
                Thread_1_LocalNode.ScriptThreadID = 1;

                bool b = false;
                try
                {
                    Thread_1_LocalNode.Evaluate(out b);
                }
                catch(Exception ex)
                {
                    if (ex.GetType() == typeof(ParserException))
                    {
                        Console.WriteLine(ex.Message);
                        if (Thread_1_ParserException != null)
                        {
                            Thread_1_ParserException( (ParserException) ex);
                        }
                        Thread_1_ParserException -= Thread_1_ParserException;
                    }
                }
                Thread_1_LocalNode.Clean();

                local.Clear();
                lock (Thread_1_Obj)
                {
                    Thread_1_Obj = null;
                }

                State_1 = ScriptThreadState.Waiting;
                //Warte am ende 1ms
                Thread.Sleep(1);
            }
        }
Exemplo n.º 4
0
        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!");
            }
        }