Esempio n. 1
0
        public Object SetControlledObject(Object pObject)
        {
            Object pOld = (Object)m_pElementsRoot;

            try
            {
                m_pElementsRoot = (IMElements)pObject;

                UpdateTree(false);
            }
            catch (System.Exception) { }

            return(pOld);
        }
Esempio n. 2
0
        void UpdateTree_R(TreeNodeCollection tvNodes, IMElements pNode)
        {
            bool bFocused = Focused;
            int  nCount   = 0;

            pNode.ElementsGetCount(out nCount);
            for (int i = 0; i < nCount; i++)
            {
                MElement pChildNode;
                pNode.ElementsGetByIndex(i, out pChildNode);

                string sType;
                pChildNode.ElementTypeGet(out sType);

                string strID;
                int    bHaveID = 0;
                pChildNode.AttributesHave("id", out bHaveID, out strID);
                if (bHaveID != 0)
                {
                    sType = sType + " [" + strID + "]";
                }

                string strShow;
                int    bHaveShow = 0;
                pChildNode.AttributesHave("show", out bHaveShow, out strShow);

                TreeNode tvNode = tvNodes.Add(sType);
                tvNode.Tag = pChildNode;

                if (bHaveShow == 0 || strShow == "1" || strShow == "true")
                {
                    tvNode.Checked = true;
                }
                else
                {
                    tvNode.Checked = false;
                }

                UpdateTree_R(tvNode.Nodes, (IMElements)pChildNode);
            }

            if (bFocused)
            {
                Focus();
            }
        }