Example #1
0
        /// <summary>
        /// before executing an action in a method.
        /// it can be called from different threads
        /// </summary>
        /// <param name="objectKey">ObjectKey of the owner of the method</param>
        /// <param name="methodWholeId">method id</param>
        /// <param name="branchId">action branch id of the action to be executed</param>
        /// <param name="executer">object instance executing the method</param>
        public void BeforeExecuteAction(string objectKey, UInt64 methodWholeId, UInt32 branchId, object executer)
        {
            if (_ComponentDebugger.Stopping)
            {
                return;
            }
            int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId;

            _ComponentDebugger.IncrementStackLevel(threadId);
            //check if it is at a break point
            MethodClass mc = _ComponentDebugger.GetMethod(methodWholeId);

            if (mc != null)
            {
                //MethodClass mc = mc0.Clone() as MethodClass;
                IActionGroup g      = mc;
                ActionBranch branch = mc.GetBranchByIdInGroup(branchId, ref g);
                if (branch != null)
                {
                    if (_ComponentDebugger.ShouldBreak(threadId) || branch.BreakBeforeExecute)
                    {
                        _ComponentDebugger.SetSelectedObject(executer);
                        _ComponentDebugger.SetAtBreak(threadId, true);
                        _debugUI.ShowBreakPoint(_ComponentDebugger);
                        branch.AtBreak = EnumActionBreakStatus.Before;
                        _ComponentDebugger.ShowBreakPointInMethod(threadId, mc, g, branch);
                        waitForBreakPoint(threadId);
                    }
                }
            }
        }