/// <summary>
 /// 组装读取的数据
 /// </summary>
 /// <param name="RootTreeItem">根节点数据</param>
 /// <param name="root">根节点XML</param>
 protected void LoadData(MyXTreeItem RootTreeItem, XmlNode root)
 {
     ///检查是否已经存在
     foreach (XmlNode node in root.SelectNodes("CodeBox"))
     {
         XmlElement  codeNode   = (XmlElement)node;
         MyXTreeItem RetreeItem = new MyXTreeItem();
         RetreeItem.IsSelected       = false;
         RetreeItem.IsExpanded       = false;
         RetreeItem.XName            = codeNode.GetAttribute("Name");
         RetreeItem.MyHitText        = codeNode.GetAttribute("HitText");
         RetreeItem.MyCodeBoxType    = CodeBox.CodeBoxTypeMapping(codeNode.GetAttribute("CodeBoxType"));
         RetreeItem.SystemCodeString = codeNode.GetAttribute("SystemCodeString");
         RetreeItem.ReturnValue      = codeNode.GetAttribute("ReturnValue");
         foreach (XmlNode xNode in codeNode.SelectNodes("XAribute"))
         {
             ///MyXTreeItem的子项
             XAributeItem xaItem = new XAributeItem();
             ///将内容提出填装
             XmlElement xaNode = (XmlElement)xNode;
             xaItem.Parameter_name   = xaNode.GetAttribute("Name");
             xaItem.MyXAttributeType = XAribute.XAttributeTypeMapping(((XmlElement)xaNode.SelectSingleNode("PointTypeitem")).InnerText);
             xaItem.MyXAttributeSpec = XAribute.XAttributeSpecMapping(((XmlElement)xaNode.SelectSingleNode("ListTypeitem")).InnerText);
             xaItem.MyXPositonStyle  = XAribute.XPositonStyleMapping(((XmlElement)xaNode.SelectSingleNode("PositionTypeitem")).InnerText);
             xaItem.MyCanLinkType    = XAribute.CanLinkTypeMapping(((XmlElement)xaNode.SelectSingleNode("LinkTypeitem")).InnerText);
             xaItem.MyHittext        = ((XmlElement)xaNode.SelectSingleNode("TipTypeitem")).InnerText;
             xaItem.MyLastExText     = ((XmlElement)xaNode.SelectSingleNode("LastExTexteitem")).InnerText;
             ///添加到子项中
             RetreeItem.MyXaributeChildren.Add(xaItem);
         }
         ///添加子节点
         RootTreeItem.ChildrenItem.Add(RetreeItem);
     }
 }
Example #2
0
        /// <summary>
        /// 读取XML中的属性内容
        /// </summary>
        /// <param name="aribute">包含属性的XML节点</param>
        /// <param name="box">属性所在的CodeBox对象</param>
        /// <returns></returns>
        public static void ReadXAributeObject(XmlNode node, PicTabPage pic)
        {
            XmlElement aributeElement = (XmlElement)node;
            int        Id             = int.Parse(aributeElement.GetAttribute("ID"));
            string     Title          = aributeElement.GetAttribute("Title");

            XAribute.XAttributeType SelectType          = XAribute.XAttributeTypeMapping(aributeElement.GetAttribute("PointTypeitem"));
            XAribute.XAttributeSpec SelectSpc           = XAribute.XAttributeSpecMapping(aributeElement.GetAttribute("ListTypeitem"));
            XAribute.XPositonStyle  SelectPositionStyle = XAribute.XPositonStyleMapping(aributeElement.GetAttribute("PositionTypeitem"));
            XAribute.CanLinkType    CanLinkNum          = XAribute.CanLinkTypeMapping(aributeElement.GetAttribute("LinkTypeitem"));
            string Hint   = aributeElement.GetAttribute("TipTypeitem");
            string ExName = aributeElement.GetAttribute("LastExTexteitem");

            XObject.OpenType opentype = XObject.OpenTypeMapping(aributeElement.GetAttribute("OpenType"));
            ///通过内置函数加载属性
            XAribute bute = pic.LoadXAribute(SelectType, SelectSpc, SelectPositionStyle, Title, CanLinkNum, Hint, ExName, Id, opentype);
        }
Example #3
0
        /// <summary>
        /// 读取XML中的属性内容
        /// </summary>
        /// <param name="aribute">包含属性的XML节点</param>
        /// <param name="box">属性所在的CodeBox对象</param>
        /// <returns></returns>
        public static void ReadXAributeObject(XmlNode node, CodeBox box)
        {
            XmlElement aributeElement = (XmlElement)node;
            int        Id             = int.Parse(aributeElement.GetAttribute("ID"));
            string     Title          = aributeElement.GetAttribute("Title");

            XAribute.XAttributeType SelectType          = XAribute.XAttributeTypeMapping(aributeElement.GetAttribute("PointTypeitem"));
            XAribute.XAttributeSpec SelectSpc           = XAribute.XAttributeSpecMapping(aributeElement.GetAttribute("ListTypeitem"));
            XAribute.XPositonStyle  SelectPositionStyle = XAribute.XPositonStyleMapping(aributeElement.GetAttribute("PositionTypeitem"));
            XAribute.CanLinkType    CanLinkNum          = XAribute.CanLinkTypeMapping(aributeElement.GetAttribute("LinkTypeitem"));
            string Hint   = aributeElement.GetAttribute("TipTypeitem");
            string ExName = aributeElement.GetAttribute("LastExTexteitem");

            XObject.OpenType opentype = XObject.OpenTypeMapping(aributeElement.GetAttribute("OpenType"));
            ///通过内置函数加载属性
            XAribute bute = box.LoadAttribute(SelectType, SelectSpc, SelectPositionStyle, Title, CanLinkNum, Hint, ExName, Id, opentype);

            if (bute != null && ISXAributeToSaveValue(bute))
            {
                bute.SetValueTextBox(aributeElement.GetAttribute("Value"));
            }
        }