Пример #1
0
        public bool FindUIConfigItem(string fullID, out XmlElement node, out IBxUIConfigFile file)
        {
            string itemID, fileID;

            BxUIConfigID.Split(fullID, out fileID, out itemID);
            return(FindUIConfigItem(itemID, fileID, out node, out file));
        }
Пример #2
0
        public IBxDefaultUnit GetDefaultUnit(string fullID)
        {
            string moduleId, id;

            BxUIConfigID.Split(fullID, out moduleId, out id);
            IBxDUProvider p = GetProvider(moduleId);

            if (p == null)
            {
                return(null);
            }
            return(p.Get(id));
        }
        public BxXmlUIItem GetStaticUIConfig(string id)
        {
            BxXmlUIItem staticUIConfig;

            if (_map.TryGetValue(id, out staticUIConfig))
            {
                return(staticUIConfig);
            }

            IBxUIConfigFile file;
            XmlElement      xmlNode;

            if (_uiConfigProvider.FindUIConfigItem(BxUIConfigID.GetItemID(id), BxUIConfigID.GetFileID(id), out xmlNode, out file))
            {
                staticUIConfig = new BxXmlUIItem(id, this, _uiConfigProvider);
                _map.Add(id, staticUIConfig);
                return(staticUIConfig);
            }
            return(null);
        }
Пример #4
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
        }