public void SetRunStatus(int threadId, EnumRunStatus status)
        {
            if (status == EnumRunStatus.Stop)
            {
                _stopping = true;
                foreach (KeyValuePair <int, ThreadDebug> kv in _threadData)
                {
                    kv.Value.Status = EnumRunStatus.Stop;
                }
            }
            else
            {
                ThreadDebug t = ThreadData(threadId);
                t.Status = status;
                if (status == EnumRunStatus.StepOver || status == EnumRunStatus.StepOut)
                {
                    t.StepOverLevel = t.StackLevel;
                }
                else if (status == EnumRunStatus.Finished)
                {
                    //a none-main thread finishes
                    setThreadGroupFinish(threadId);
                    setViewerBackColor();
                }
            }
            FormDebugger f = this.FindForm() as FormDebugger;

            if (f != null)
            {
                f.setButtonImages();
            }
        }
        private void showBreakPointInMethod(int threadId, MethodClass method, IActionGroup group, ActionBranch branch)
        {
            MethodDesignerHolder h = getViewer(threadId, method, group, branch);

            if (h == null)
            {
                IActionGroup g = (IActionGroup)(group.Clone());
                g = g.GetThreadGroup(branch.BranchId);
                //create a viewer
                SplitContainer c            = getLastContainer(splitContainer1);
                SplitContainer newContainer = new SplitContainer();
                newContainer.Dock = DockStyle.Fill;
                c.Panel2.Controls.Add(newContainer);
                c.Panel2Collapsed            = false;
                newContainer.Panel2Collapsed = true;
                h          = Activator.CreateInstance(g.ViewerHolderType, this, _designer) as MethodDesignerHolder;
                h.ThreadId = threadId;
                h.SetBackgroundText(group.GroupName);
                h.Dock = DockStyle.Fill;
                newContainer.Panel1.Controls.Add(h);
                h.LoadActions(g);
                _currentThreadId              = threadId;
                h.DesignerSelected           += new EventHandler(h_DesignerSelected);
                newContainer.Panel1.GotFocus += new EventHandler(Panel1_GotFocus);
                newContainer.SplitterMoved   += new SplitterEventHandler(newContainer_SplitterMoved);
                newContainer.Resize          += new EventHandler(newContainer_Resize);
            }
            else
            {
                if (h.ActionGroup.GroupFinished)
                {
                    h.ActionGroup.GroupFinished = false;
                    ThreadDebug td = ThreadData(threadId);
                    if (td.Status == EnumRunStatus.Finished)
                    {
                        FormDebugger f = this.FindForm() as FormDebugger;
                        if (f != null)
                        {
                            td.Status = f.DebugCommandStatus;
                        }
                        else
                        {
                            td.Status = EnumRunStatus.Run;
                        }
                    }
                    UpdateViewersBackColor();
                }
            }
            h.UpdateBreakpoint(branch);
        }
        private ThreadDebug ThreadData(int threadId)
        {
            ThreadDebug d;

            if (_threadData == null)
            {
                _threadData = new Dictionary <int, ThreadDebug>();
            }
            if (!_threadData.TryGetValue(threadId, out d))
            {
                d = new ThreadDebug();
                _threadData.Add(threadId, d);
            }
            return(d);
        }
        public void DecrementStackLevel(int threadId)
        {
            ThreadDebug t = ThreadData(threadId);

            t.StackLevel = t.StackLevel - 1;
        }
        public int GetCallStackLevel(int threadId)
        {
            ThreadDebug t = ThreadData(threadId);

            return(t.StackLevel);
        }
        public bool ReachStepOut(int threadId)
        {
            ThreadDebug t = ThreadData(threadId);

            return(t.StackLevel < t.StepOverLevel);
        }