public UserControlDebugger(LimnorDebugger debugger)
            : base()
        {
            _threadData = new Dictionary <int, ThreadDebug>();
            _debugger   = debugger;
            //
            miSetSelectedObject       = new fnOnObject(setSelectedObj);
            miShowBreakPointInMethod  = new fnShowBreakPointInMethod(showBreakPointInMethod);
            miClearBreakPointInMethod = new fnShowBreakPointInMethod(clearBreakPointInMethod);
            miShowActiveControl       = new fnOnControl(showActiveControl0);
            //
            InitializeComponent();
            //
            //
            _rootClassId = ClassPointer.CreateClassPointer(_debugger.Project, _debugger.RootXmlNode);
            _classId     = _rootClassId.ClassId;
            _rootClassId.LoadActions(_rootClassId);
            _methods  = _rootClassId.CustomMethods;
            _designer = new MethodDebugDesigner(_rootClassId, _debugger.Project);
            TreeNodeClassRoot r = treeView1.CreateClassRoot(true, _rootClassId, false);

            treeView1.Nodes.Add(r);
            treeView1.GotFocus += new EventHandler(treeView1_GotFocus);
            //
        }
예제 #2
0
        public virtual void OnNodeAfterSelection(TreeViewEventArgs e)
        {
            HtmlElement_Base he   = HtmlElement;
            Guid             guid = Guid.Empty;

            if (string.CompareOrdinal(he.tagName, "body") != 0)
            {
                if (he.ElementGuid != Guid.Empty)
                {
                    guid = he.ElementGuid;
                }
            }
            if (guid != Guid.Empty)
            {
                TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer;
                if (tv != null)
                {
                    TreeNodeClassRoot r = tv.RootClassNode;
                    if (r != null && r.ClassData.DesignerHolder != null)
                    {
                        r.ClassData.DesignerHolder.OnSelectedHtmlElement(guid, tv);
                    }
                }
            }
        }
        public void OnDataLoaded()
        {
            ClassPointer      objId = _loader.GetRootId();
            TreeNodeClassRoot r     = TreeNodeClassRoot.CreateClassRoot(true, objId, EnumObjectSelectType.All, null, null, _objExplorer.StaticScope);

            //r.ClassData.SetDesignerHolder(_holder);
            r.SetDesigner(_loader);
            _objExplorer.Nodes.Add(r);
            if (!objId.IsStatic)
            {
                _objExplorer.Nodes.Add(new TreeNodeDatabaseConnectionList(objId));
            }
            _objExplorer.Nodes.Add(new TreeNodeActionCollection(r, false, objId, 0, EnumObjectSelectType.All, null, null));
            _objExplorer.LoadTypeNodes();
            txtDesc.Text = SerializeUtil.GetNodeDescription(_loader.Node);
        }
예제 #4
0
 private void mi_useIt(object sender, EventArgs e)
 {
     if (!(this.HtmlElement is HtmlElementUnknown) && this.HtmlElement.ElementGuid == Guid.Empty)
     {
         HtmlElement_BodyBase hbb = this.HtmlElement as HtmlElement_BodyBase;
         if (hbb != null)
         {
             TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer;
             if (tv != null)
             {
                 TreeNodeClassRoot ownerNode = tv.DesignerRootNode;
                 if (ownerNode != null)
                 {
                     ClassPointer root = ownerNode.ClassData.RootClassID;
                     root.UseHtmlElement(hbb, tv.FindForm());
                 }
             }
         }
     }
 }
        public void OnDataLoaded()
        {
            ClassPointer      objId = _loader.GetRootId();
            TreeNodeClassRoot r     = _objExplorer.CreateClassRoot(true, objId, _objExplorer.StaticScope);

            r.SetDesigner(_loader);
            _objExplorer.Nodes.Add(r);
            _objExplorer.Nodes.Add(new TreeNodeDocCollection(_objExplorer, objId));
            if (objId.Interface == null)
            {
                if (!objId.IsStatic)
                {
                    _objExplorer.Nodes.Add(new TreeNodeDatabaseConnectionList(objId));
                }
                TreeNodeActionCollection tnas = new TreeNodeActionCollection(_objExplorer, r, false, objId, 0);
                _objExplorer.Nodes.Add(tnas);
                tnas.AdjustActionIcon();
            }
            _objExplorer.LoadTypeNodes();
            txtDesc.Text = SerializeUtil.GetNodeDescription(_loader.Node);
        }
        public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode)
        {
            if (tv != null && tv.RootId != null && parentNode != null && parentNode.OwnerPointer != null && parentNode.OwnerPointer.RootPointer != null)
            {
                if (tv.Project != null && (tv.Project.ProjectType == EnumProjectType.WebAppPhp || tv.Project.ProjectType == EnumProjectType.WebAppAspx))
                {
                    if (tv.RootId.ClassId != parentNode.OwnerPointer.RootPointer.ClassId)
                    {
                        return;
                    }
                }
            }
            IObjectPointer    objRef   = parentNode.OwnerPointer;
            TreeNodeClassRoot topClass = parentNode.TopLevelRootClassNode;
            bool forPhp = false;

            if (tv.Project != null)
            {
                forPhp = (tv.Project.ProjectType == EnumProjectType.WebAppPhp);
            }
            Dictionary <UInt32, IAction> actions = null;

            if (topClass != null)
            {
                if (!topClass.StaticScope)
                {
                    actions = topClass.GetActions();
                }
            }
            else
            {
                TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType;
                if (rootType != null)
                {
                    actions = rootType.GetActions();
                }
            }
            SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>();
            HtmlElement_BodyBase          heb      = (HtmlElement_BodyBase)parentNode.OwnerIdentity;

            MethodInfo[] mifs = heb.GetType().GetMethods();
            if (mifs != null)
            {
                for (int i = 0; i < mifs.Length; i++)
                {
                    if (parentNode.SelectionTarget == EnumObjectSelectType.Object)
                    {
                        if (mifs[i].ReturnType.Equals(typeof(void)))
                        {
                            continue;
                        }
                        ParameterInfo[] ps = mifs[i].GetParameters();
                        if (ps != null && ps.Length > 0)
                        {
                            continue;
                        }
                    }
                    if (VPLUtil.IsNotForProgramming(mifs[i]))
                    {
                        continue;
                    }
                    if (!WebClientMemberAttribute.IsClientMethod(mifs[i]) && !WebServerMemberAttribute.IsServerMethod(mifs[i]))
                    {
                        continue;
                    }
                    MethodInfoPointer mp = new MethodInfoPointer();
                    mp.Owner = objRef;
                    mp.SetMethodInfo(mifs[i]);
                    int            c;
                    TreeNodeMethod nodeMethod = new TreeNodeMethod(ForStatic, mp);
                    string         key        = mp.GetMethodSignature(out c);
                    TreeNode       nodeExist;
                    if (newNodes.TryGetValue(key, out nodeExist))
                    {
                        TreeNodeMethod mnd = (TreeNodeMethod)nodeExist;
                        if (mnd.MethodInformation.DeclaringType.Equals(mnd.MethodInformation.ReflectedType))
                        {
                            key = key + " - " + mifs[i].DeclaringType.Name;
                            newNodes.Add(key, nodeMethod);
                        }
                        else
                        {
                            if (mifs[i].DeclaringType.Equals(mifs[i].ReflectedType))
                            {
                                newNodes[key] = nodeMethod;
                                key           = key + " - " + mnd.MethodInformation.DeclaringType.Name;
                                newNodes.Add(key, mnd);
                            }
                            else
                            {
                                key = key + " - " + mifs[i].DeclaringType.Name;
                                newNodes.Add(key, nodeMethod);
                            }
                        }
                    }
                    else
                    {
                        newNodes.Add(key, nodeMethod);
                    }
                    //load actions
                    if (actions != null)
                    {
                        bool bHasActions = false;
                        foreach (IAction a in actions.Values)
                        {
                            ActionClass ac = a as ActionClass;
                            if (ac != null)
                            {
                                MethodPointer mp0 = ac.ActionMethod as MethodPointer;
                                if (mp0 != null)
                                {
                                    if (mp0.IsSameObjectRef(mp))
                                    {
                                        bHasActions = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if (bHasActions)
                        {
                            nodeMethod.ShowActionIcon();
                        }
                    }
                }
                parentNode.AddSortedNodes(newNodes);
            }
        }
        public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode)
        {
            UInt32 scopeId = parentNode.ScopeMethodId;
            SortedList <string, TreeNode> newNodes = new SortedList <string, TreeNode>();
            HtmlElement_BodyBase          heb      = (HtmlElement_BodyBase)parentNode.OwnerIdentity;
            PropertyDescriptorCollection  pifs     = TypeDescriptor.GetProperties(heb.GetType());
            TreeNodeClassRoot             topClass = parentNode.TopLevelRootClassNode;
            Dictionary <UInt32, IAction>  actions  = null;

            if (topClass != null)
            {
                if (!topClass.StaticScope)
                {
                    actions = topClass.GetActions();
                }
            }
            else
            {
                if (tv != null)
                {
                    if (tv.RootClassNode != null)
                    {
                        actions = tv.RootClassNode.GetActions();
                    }
                }
                if (actions == null)
                {
                    TreeNodeClassType rootType = parentNode.TopLevelNode as TreeNodeClassType;
                    if (rootType != null)
                    {
                        actions = rootType.GetActions();
                    }
                }
            }
            for (int i = 0; i < pifs.Count; i++)
            {
                if (NotForProgrammingAttribute.IsNotForProgramming(pifs[i]))
                {
                    continue;
                }
                if (!WebClientMemberAttribute.IsClientProperty(pifs[i]) && !WebServerMemberAttribute.IsServerProperty(pifs[i]))
                {
                    continue;
                }
                TreeNodeProperty nodeProperty;
                PropertyPointer  pp;
                pp       = new PropertyPointer();
                pp.Owner = new HtmlElementPointer(heb);
                pp.SetPropertyInfo(pifs[i]);
                if (!newNodes.ContainsKey(pp.Name))
                {
                    nodeProperty = new TreeNodeProperty(ForStatic, pp);
                    try
                    {
                        newNodes.Add(pp.Name, nodeProperty);
                    }
                    catch (Exception err)
                    {
                        MathNode.Log(tv != null ? tv.FindForm() : null, err);
                    }
                    //load actions
                    bool bHasActions = false;
                    if (string.CompareOrdinal(pp.Name, "Cursor") == 0)
                    {
                        bHasActions = false;
                    }
                    if (actions != null)
                    {
                        foreach (IAction a in actions.Values)
                        {
                            if (a != null && a.IsStatic == parentNode.IsStatic)
                            {
                                if (nodeProperty.IncludeAction(a, tv, scopeId, false))
                                {
                                    bHasActions = true;
                                    break;
                                }
                            }
                        }
                        if (bHasActions)
                        {
                            nodeProperty.OnShowActionIcon();
                        }
                    }
                }
            }
            parentNode.AddSortedNodes(newNodes);
        }