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 h_DesignerSelected(object sender, EventArgs e) { MethodDesignerHolder h = sender as MethodDesignerHolder; if (h != null) { _currentViewer = h; _currentThreadId = h.ThreadId; if (treeView1.ThreadId == _currentThreadId) { treeView1.BackColor = Color.LightYellow; } else { treeView1.BackColor = Color.White; } h.SetViewerBackColor(); showActiveControl(splitContainer1, h.Parent); FormDebugger f = this.FindForm() as FormDebugger; if (f != null) { f.setButtonImages(); } } }
public void LeaveEvent(string objectKey, string eventName, object executer) { if (_ComponentDebugger.Stopping) { return; } EventAction ea = _ComponentDebugger.RootClass.GetEventHandler(eventName, objectKey); if (ea != null) { int threadId = System.Threading.Thread.CurrentThread.ManagedThreadId; EnumRunStatus status = _ComponentDebugger.GetRunStatus(threadId); if ((status != EnumRunStatus.Stop && status != EnumRunStatus.Run) || ea.BreakAfterExecute) { _ComponentDebugger.SetSelectedObject(executer); _ComponentDebugger.SetAtBreak(threadId, true); _debugUI.ShowBreakPoint(_ComponentDebugger); _ComponentDebugger.ShowEventBreakPointInTreeView(objectKey, eventName, executer, false); waitForBreakPoint(threadId); } } _ComponentDebugger.ClearBreakpointDisplay(); _ComponentDebugger.LeaveEvent(); FormDebugger f = _ComponentDebugger.FindForm() as FormDebugger; if (f != null) { f.setButtonImages(); } }
public LimnorDebugger(string project, string component) { _componentFile = component; _projectFile = project; bool fileFound = System.IO.File.Exists(_componentFile); if (fileFound) { _doc = new XmlDocument(); _doc.Load(_componentFile); _projectFile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(_componentFile), System.IO.Path.GetFileName(_projectFile)); _projectFile = _projectFile.ToLowerInvariant(); if (!_debuggerList.TryGetValue(_projectFile, out _debugUI)) { _debugUI = null; System.Threading.Thread th = new System.Threading.Thread(showDebugWindow); th.SetApartmentState(System.Threading.ApartmentState.STA); th.Start(); while (_debugUI == null) { Application.DoEvents(); } _debugUI.MainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; _debuggerList.Add(_projectFile, _debugUI); while (!_debugUI.FormReady) { Application.DoEvents(); } } _ComponentDebugger = _debugUI.AddTab(this); } }
void treeView1_GotFocus(object sender, EventArgs e) { _currentViewer = null; FormDebugger f = this.FindForm() as FormDebugger; if (f != null) { _currentThreadId = f.MainThreadId; treeView1.BackColor = Color.LightYellow; showActiveControl(splitContainer1, splitContainer1.Panel1); 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); }
public void RefreshUI() { FormDebugger f = this.FindForm() as FormDebugger; f.RefreshUI(); }
private void showDebugWindow(object v) { _debugUI = new FormDebugger(_projectFile); _debugUI.ShowDialog(); }