예제 #1
0
        public void LoadUnitConfigFile(string sFilePath)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(sFilePath);
                XmlElement  root      = doc.DocumentElement;
                XmlNodeList cateNodes = root.SelectNodes("Category");

                List <IBxUnitCategory> cates = new List <IBxUnitCategory>(cateNodes.Count);

                BxSubSetUnitCategory cate;
                IBxUnitCategory      baseCate;
                string id, name;
                foreach (XmlElement one in cateNodes)
                {
                    id   = one.GetAttribute("id");
                    name = one.GetAttribute("help");
                    if (string.IsNullOrWhiteSpace(name))
                    {
                        name = id;
                    }
                    baseCate = _baseUnitsCenter.Parse(id);
                    cate     = new BxSubSetUnitCategory(baseCate, name);
                    cate.LoadUnitConfigNode(one);
                    cates.Add(cate);
                }
                cates.Sort((x, y) => string.Compare(x.Name, y.Name));
                _cates = cates;
            }
            catch (System.Exception) { }
        }
예제 #2
0
파일: Unit.cs 프로젝트: presscad/BaseLayer
        public static IBxUnit EMParse(this IBxUnitsCenter center, string unitCate, string unit)
        {
            IBxUnitCategory cate = center.Parse(unitCate);

            if (cate == null)
            {
                return(null);
            }
            return(cate.Parse(unit));
        }
예제 #3
0
        static protected IBxUnit S_ParseUnit(string unitCate, string unit)
        {
            IBxUnitsCenter  units = BLSystemInfo.Instance.Units;
            IBxUnitCategory cate  = units.Parse(unitCate);

            if (cate != null)
            {
                return(cate.Parse(unit));
            }
            return(null);
        }