Beispiel #1
0
        BLXmlConfigItem CreateItem(XmlElement node)
        {
            BLXmlConfigItem item = new BLXmlConfigItem();

            InitItem(item, node);
            return(item);
        }
Beispiel #2
0
        BLXmlConfigItem CreateItem(BLXmlConfigItem defaultItem, XmlElement node)
        {
            BLXmlConfigItem item = defaultItem.Copy();

            InitItem(item, node);
            return(item);
        }
Beispiel #3
0
        public BLXmlUIConfigGroup(XmlElement xmlNode)
        {
            _xmlNode = xmlNode;
            XmlElement defaultValue = xmlNode.SelectSingleNode("UIConfigGroup/DefaultValue") as XmlElement;

            _defaultItem = CreateItem(defaultValue);
        }
Beispiel #4
0
 public override object GetValue(BLXmlConfigItem cfg)
 {
     if ((cfg._validFlag & _flagMask) == 0)
     {
         return(null);
     }
     return((cfg._flag & _flagMask) != 0);
 }
Beispiel #5
0
 public bool?GetValueEx(BLXmlConfigItem cfg)
 {
     if ((cfg._validFlag & _flagMask) == 0)
     {
         return(null);
     }
     return((cfg._flag & _flagMask) != 0);
 }
Beispiel #6
0
        public IBLUIConfig GetItemConfig(int configItemID)
        {
            BLXmlConfigItem item = _items.Find(x => x.ID == configItemID);

            if ((item == null) && (_xmlNode != null))
            {
                XmlElement node = _xmlNode.SelectSingleNode(string.Format(".//UIItem[@id={0}]", configItemID)) as XmlElement;
                item = CreateItem(_defaultItem, node);
            }
            return(item);
        }
Beispiel #7
0
 public void SetValueEx(BLXmlConfigItem cfg, bool?val)
 {
     if (val.HasValue)
     {
         cfg._validFlag |= _flagMask;
         if (val.Value)
         {
             cfg._flag |= _flagMask;
         }
         else
         {
             cfg._flag &= ~_flagMask;
         }
     }
     else
     {
         cfg._validFlag &= ~_flagMask;
     }
 }
Beispiel #8
0
 public override void SetValue(BLXmlConfigItem cfg, object val)
 {
     if (val == null)
     {
         cfg._validFlag &= ~_flagMask;
     }
     else
     {
         if (!(val is bool))
         {
             throw new Exception(string.Format("item %s is only support bool type.\n", key));
         }
         if ((bool)val)
         {
             cfg._flag |= _flagMask;
         }
         else
         {
             cfg._flag &= ~_flagMask;
         }
         cfg._validFlag |= _flagMask;
     }
 }
Beispiel #9
0
 public override object GetValue(BLXmlConfigItem cfg)
 {
     return(dlgt_GetValue(cfg));
 }
Beispiel #10
0
 public override bool HasValue(BLXmlConfigItem cfg)
 {
     return((cfg._validFlag & _flagMask) != 0);
 }
Beispiel #11
0
 public void SetValueEx(BLXmlConfigItem cfg, T val)
 {
     dlgt_SetValue(cfg, val);
 }
Beispiel #12
0
        void InitItem(BLXmlConfigItem item, XmlElement node)
        {
            string s = node.GetAttribute(BLXmlConfigItem.s_itemID.key);

            if (!string.IsNullOrEmpty(s))
            {
                item.ID = S_ParseInt(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemName.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.Name = s;
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemShow.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.Show = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemShowTitle.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.ShowTitle = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemExpand.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.Expand = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemUserHide.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.UserHide = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemReadOnly.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.ReadOnly = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemValueReadOnly.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.ValueReadOnly = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemFold.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.Fold = S_ParseBool(s);
            }

            s = node.GetAttribute(BLXmlConfigItem.s_itemControlType.key);
            if (!string.IsNullOrEmpty(s))
            {
                item.ControlType = S_ParseInt(s);
            }

            string unitCate = node.GetAttribute("unitCate");

            s         = node.GetAttribute(BLXmlConfigItem.s_itemUnit.key);
            item.Unit = S_ParseUnit(unitCate, s);

            s = node.GetAttribute(BLXmlConfigItem.s_itemColumn.key);
            int columnID = S_ParseInt(s);

            if (columnID > 0)
            {
                item.Column = GetColumn(columnID);
            }

            item.MultiColumn = CreateMultiColumn(node);

            //s = node.GetAttribute(BLXmlConfigItem.s_itemRatio.key);
            //item.Ratio = S_ParseRatio(s);
        }
Beispiel #13
0
 public T GetValueEx(BLXmlConfigItem cfg)
 {
     return(dlgt_GetValue(cfg));
 }
Beispiel #14
0
 public abstract object GetValue(BLXmlConfigItem cfg);
Beispiel #15
0
 static protected void S_Set_Name(BLXmlConfigItem cfg, string val)
 {
     cfg._name = val;
 }
Beispiel #16
0
 public abstract void SetValue(BLXmlConfigItem cfg, object val);
Beispiel #17
0
 public abstract bool HasValue(BLXmlConfigItem cfg);
Beispiel #18
0
        //static readonly public _Item<BLRatio> s_itemRatio = new _Item<BLRatio>("ratio", x => x._ratio, (x, s) => x._ratio = s);

        static protected string S_Get_Name(BLXmlConfigItem cfg)
        {
            return(cfg._name);
        }
Beispiel #19
0
 public override void SetValue(BLXmlConfigItem cfg, object val)
 {
     dlgt_SetValue(cfg, (T)val);
 }
Beispiel #20
0
        public BLXmlConfigItem Copy()
        {
            BLXmlConfigItem item = this.MemberwiseClone() as BLXmlConfigItem;

            return(item);
        }
Beispiel #21
0
 public override bool HasValue(BLXmlConfigItem cfg)
 {
     return(dlgt_GetValue(cfg) != null);
 }