Ejemplo n.º 1
0
            public EE.AsyncResult Assign(StackFrame frame, TargetObject obj,
                                         EE.EvaluationCallback callback)
            {
                AsyncResult async = new AsyncResult(this);

                ST.ThreadPool.QueueUserWorkItem(delegate {
                    ScriptingContext context    = new ScriptingContext(Parser.Interpreter);
                    context.InterruptionHandler = async;
                    context.CurrentFrame        = frame;

                    object data;
                    EE.EvaluationResult result = DoAssignWorker(
                        context, obj, out data);
                    callback(result, data);
                    async.WaitHandle.Set();
                });

                return(async);
            }
Ejemplo n.º 2
0
            public EE.AsyncResult Evaluate(StackFrame frame, EE.EvaluationFlags flags,
                                           EE.EvaluationCallback callback)
            {
                AsyncResult async = new AsyncResult(this);

                ST.ThreadPool.QueueUserWorkItem(delegate {
                    ScriptingContext context    = new ScriptingContext(Parser.Interpreter);
                    context.InterruptionHandler = async;
                    context.CurrentFrame        = frame;

                    if ((flags & EE.EvaluationFlags.NestedBreakStates) != 0)
                    {
                        context.ScriptingFlags |= ScriptingFlags.NestedBreakStates;
                    }

                    object data;
                    EE.EvaluationResult result = DoEvaluateWorker(context, out data);
                    callback(result, data);
                    async.WaitHandle.Set();
                });

                return(async);
            }