private void treeViewTraces_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            object tagObject = e.Node.Tag;

            if (tagObject is DebugTracePanel)
            {
                DebugTracePanel tracePanel = tagObject as DebugTracePanel;
                string          radName    = tracePanel.RADName;
                string          panelName  = tracePanel.PanelInfo.PanelName;
                RADPanel        radPanel   = GetRADPanel(radName, panelName);
                if (radPanel != null)
                {
                    tracePanel.PanelInfo = radPanel;
                }
                string formatName = tracePanel.PanelInfo.Format;

                Format        format        = GetFormatInfo(formatName, "en");
                FormatControl formatControl = new FormatControl(format);
                formatControl.DebugTrace = tracePanel;
                panelRADDetail.Controls.Clear();
                panelRADDetail.Controls.Add(formatControl);
                PopulateFormData(tracePanel.PanelInfo, formatControl);

                ShowContext(tracePanel);
            }
        }
 private void ShowContext(DebugTracePanel tracePanel)
 {
     listViewContext.Items.Clear();
     foreach (KeyValuePair <string, string> keyValuePair in tracePanel.PreContext.NamedVarValues)
     {
         ListViewItem listViewItem = new ListViewItem();
         listViewItem.Text = keyValuePair.Key;
         listViewItem.SubItems.Add(keyValuePair.Value);
         if (tracePanel.PostContext != null && tracePanel.PostContext.NamedVarValues.Keys.Contains(keyValuePair.Key))
         {
             listViewItem.SubItems.Add(tracePanel.PostContext.NamedVarValues[keyValuePair.Key]);
         }
         listViewContext.Items.Add(listViewItem);
     }
 }
        public void AddTrace(Execute excuteObject)
        {
            ClientRequest clientRequest = excuteObject.ClientRequestEntity;

            if (clientRequest != null)
            {
                for (int i = clientRequest.Messages.Messages.Count - 1; i >= 0; i--)
                //for (int i = 0; i < clientRequest.Messages.Messages.Count ; i++)
                {
                    MessageItem messageItem  = clientRequest.Messages.Messages[i];
                    string      debugMessage = messageItem.Text.Trim();

                    //rad call.
                    if (radCallReg.IsMatch(debugMessage))
                    {
                        TraceChangedInfo changedInfo = new TraceChangedInfo();
                        changedInfo.OldRad   = currentRAD;
                        changedInfo.OldPanel = currentTrance as DebugTracePanel;

                        Match           radMatch       = radCallReg.Match(debugMessage);
                        GroupCollection groups         = radMatch.Groups;
                        string          threadId       = groups[1].Value;
                        string          currentRADName = groups[2].Value;
                        if (!followingReturn)
                        {
                            DebugTraceRADCall newRadCall = new DebugTraceRADCall();
                            newRadCall.Parent  = currentRAD;
                            newRadCall.RADName = currentRADName;

                            currentRAD.Traces.Add(newRadCall);
                            currentRAD = newRadCall;
                            radStack.Push(currentRADName);

                            currentTrance        = null;
                            changedInfo.NewRad   = currentRAD;
                            changedInfo.NewPanel = null;
                            changedInfo.Type     = TraceChangedType.NewRADCall;
                            if (OnTraceChanged != null)
                            {
                                OnTraceChanged(this, changedInfo);
                            }
                        }
                        else
                        {
                            //Check if current value is the same as the parent rad
                            if (currentRAD.RADName != currentRADName)
                            {
                                do
                                {
                                    radStack.Pop();
                                    currentRAD = currentRAD.Parent as DebugTraceRADCall;
                                }while (currentRADName != currentRAD.RADName);
                                //throw new Exception("RAD stack mismatched...");
                            }
                        }


                        followingReturn = false;
                        //nothing to do
                    }
                    else if (returnReg.IsMatch(debugMessage))
                    {
                        followingReturn = true;
                        TraceChangedInfo changedInfo = new TraceChangedInfo();
                        changedInfo.OldRad   = currentRAD;
                        changedInfo.OldPanel = currentTrance as DebugTracePanel;

                        radStack.Pop();
                        currentRAD = currentRAD.Parent as DebugTraceRADCall;

                        currentTrance        = null;
                        changedInfo.NewRad   = currentRAD;
                        changedInfo.NewPanel = null;
                        changedInfo.Type     = TraceChangedType.RADCallReturn;

                        if (OnTraceChanged != null)
                        {
                            OnTraceChanged(this, changedInfo);
                        }
                    }
                    else if (panelReg.IsMatch(debugMessage))
                    {
                        followingReturn = false;
                        TraceChangedInfo changedInfo = new TraceChangedInfo();
                        changedInfo.OldRad   = currentRAD;
                        changedInfo.OldPanel = currentTrance as DebugTracePanel;


                        Match           radMatch         = panelReg.Match(debugMessage);
                        GroupCollection groups           = radMatch.Groups;
                        string          threadId         = groups[1].Value;
                        string          currentPanelName = groups[2].Value;

                        RADPanel panel = new RADPanel();
                        panel.RADName   = currentRAD.RADName;
                        panel.PanelName = currentPanelName;

                        DebugTracePanel tracePanel = new DebugTracePanel();
                        tracePanel.PanelInfo = panel;
                        tracePanel.Parent    = currentRAD;
                        currentRAD.Traces.Add(tracePanel);
                        currentTrance = tracePanel;

                        changedInfo.NewRad   = currentRAD;
                        changedInfo.NewPanel = currentTrance as DebugTracePanel;
                        changedInfo.Type     = TraceChangedType.NewPanel;
                        if (OnTraceChanged != null)
                        {
                            OnTraceChanged(this, changedInfo);
                        }
                    }
                    else
                    {
                        //followingReturn = false;
                    }
                    //radStack.Push(messageItem);
                }
            }
        }