Esempio n. 1
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 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);
        }