Ejemplo n.º 1
0
 public BxSubColumns(BxSUICSubColums suicColumns)
 {
     _suicColumns = suicColumns;
     _columns     = new List <BxSubColumn>(suicColumns.SubColumns.Length);
     Array.ForEach(suicColumns.SubColumns, x => _columns.Add(new BxSubColumn(x)));
 }
Ejemplo n.º 2
0
        protected void Init()
        {
            if (_inited)
            {
                return;
            }
            _inited = true;

            XmlElement      node;
            IBxUIConfigFile _xmlFile;

            _uicProvider.FindUIConfigItem(_id, out node, out _xmlFile);
            if (node == null)
            {
                throw new Exception(string.Format("Can not find item {0} From UIConfig file{1}.", _id, _xmlFile.ID));
            }

            //取itemID
            //_id  = node.GetAttribute(BxXmlConfigField.id);

            //取name
            _name = node.GetAttribute(BxXmlConfigField.name);

            //取标志位
            #region 取标志位
            _flag = new BxUIItemFlag();
            string s;

            s = node.GetAttribute(BxXmlConfigField.show);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.Show = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.showTitle);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.ShowTitle = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.expand);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.Expand = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.userHide);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.UserHide = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.readOnly);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.ReadOnly = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.valueReadOnly);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.ValueReadOnly = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.fold);
            if (!string.IsNullOrEmpty(s))
            {
                _flag.Fold = S_ParseBool(s);
            }

            s = node.GetAttribute(BxXmlConfigField.controlType);
            if (!string.IsNullOrEmpty(s))
            {
                _controlType = S_ParseNullInt(s);
            }
            #endregion

            //取subArrayUIItemID
            _subArrayUIItemID = node.GetAttribute(BxXmlConfigField.arrayElement);

            //取ICOn
            _Icon = node.GetAttribute(BxXmlConfigField.icon);

            double temp;
            double?min      = null;
            bool   minValid = false;
            double?max      = null;
            bool   maxValid = false;

            s = node.GetAttribute(BxXmlConfigField.min);
            if (double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out temp))
            {
                min      = temp;
                minValid = false;
            }
            else
            {
                s = node.GetAttribute(BxXmlConfigField.minEx);
                if (double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out temp))
                {
                    min      = temp;
                    minValid = true;
                }
            }

            s = node.GetAttribute(BxXmlConfigField.max);
            if (double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out temp))
            {
                max      = temp;
                maxValid = false;
            }
            else
            {
                s = node.GetAttribute(BxXmlConfigField.maxEx);
                if (double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out temp))
                {
                    max      = temp;
                    maxValid = true;
                }
            }
            if (min.HasValue || max.HasValue)
            {
                _range = new BxRange(min, minValid, max, maxValid);
            }

            //取subArrayUIItemID
            _menuWidth = node.GetAttribute(BxXmlConfigField.menuWidth);

            //取HelpString
            _tip = node.GetAttribute(BxXmlConfigField.HelpString);


            //取单位
            #region 取单位
            s = node.GetAttribute(BxXmlConfigField.unitCate);
            if (!string.IsNullOrEmpty(s))
            {
                string unit = node.GetAttribute(BxXmlConfigField.unit);
                _unit = new BxUnitList(s, unit);
            }
            else
            {
                string unitItem = node.GetAttribute(BxXmlConfigField.unitItem);
                if (!string.IsNullOrEmpty(unitItem))
                {
                    XmlNodeList unitItems = node.SelectNodes(BxXmlConfigNodeName.unitItemNode);
                    string[]    units     = new string[unitItems.Count];
                    string[]    unitCates = new string[unitItems.Count];
                    int         i         = 0;
                    foreach (XmlElement one in unitItems)
                    {
                        unitCates[i] = one.GetAttribute(BxXmlConfigField.unitCate);
                        units[i]     = one.GetAttribute(BxXmlConfigField.unit);
                    }
                    _unit = new BxUnitList(unitCates, units);
                }
            }
            #endregion

            //取decimalDigits
            s = node.GetAttribute(BxXmlConfigField.decimalDigits);
            if (!string.IsNullOrEmpty(s))
            {
                _decimalDigits = S_ParseInt(s);
            }

            //取columnID
            _column = node.GetAttribute(BxXmlConfigField.uiColumn);

            //取subColumns
            #region 取subColumns
            s = node.GetAttribute(BxXmlConfigField.subColumns);
            if (!string.IsNullOrEmpty(s))
            {
                Int32       centerSubCol = S_ParseInt(node.GetAttribute(BxXmlConfigField.centerSubCol));
                XmlNodeList child        = node.SelectNodes(BxXmlConfigNodeName.subColNode);
                _suicSubColums = new BxSUICSubColums(child.Count, centerSubCol);

                string fileID = BxUIConfigID.GetFileID(_id);
                string id;
                UInt16 ratio;
                int    index = 0;
                foreach (XmlElement one in child)
                {
                    id    = BxUIConfigID.Combine(fileID, one.GetAttribute(BxXmlConfigField.id));
                    ratio = S_ParseUInt16(one.GetAttribute(BxXmlConfigField.width));
                    _suicSubColums.InitColumn(index, id, _suicProvider, ratio);
                    index++;
                }
            }
            #endregion
        }
Ejemplo n.º 3
0
 public BxSubColumns()
 {
     _suicColumns = null;
     _columns     = null;
 }
Ejemplo n.º 4
0
 protected BxMutiColumns()
 {
     _suicColumns = null;
     _columns     = null;
 }