示例#1
0
        protected virtual void loadPrimitiveParams(XmlElement e)
        {
            XmlNode xn = e.SelectSingleNode("structure");

            if (xn != null)
            {
                _categories = new StructCategories(xn, this.id);
            }
            else
            {
                _categories = new StructCategories();
            }

            if (_categories.Count == 0)
            {
                StructCategory.Root.Entries.Add(this.id);
                _categories.Add(StructCategory.Root);
            }

            try {
                _design = e.SelectSingleNode("design").InnerText;
            } catch {
                //! _design = "標準";
                _design = "default";
            }

            _unitPrice = int.Parse(XmlUtil.selectSingleNode(e, "price").InnerText);
            _size      = XmlUtil.parseSize(XmlUtil.selectSingleNode(e, "size").InnerText);
            _areaPrice = _unitPrice / Math.Max(1, size.x * size.y);

            _minHeight = 2;
            try {
                _maxHeight = int.Parse(e.SelectSingleNode("maxHeight").InnerText);
                try {
                    // if minHeight is not defined, use default.
                    _minHeight = int.Parse(e.SelectSingleNode("minHeight").InnerText);
                } catch {}
            } catch {
                // if maxHeight tag is nod find, height tag must be exist.
                _maxHeight = int.Parse(XmlUtil.selectSingleNode(e, "height").InnerText);
            }
        }
        protected override void loadPrimitiveParams(XmlElement e)
        {
            XmlNode xn = e.SelectSingleNode("structure");

            if (xn != null)
            {
                _categories = new StructCategories(xn, this.id);
            }
            else
            {
                _categories = new StructCategories();
            }

            if (_categories.Count == 0)
            {
                StructCategory.Root.Entries.Add(this.id);
                _categories.Add(StructCategory.Root);
            }

            try
            {
                _design = e.SelectSingleNode("design").InnerText;
            }
            catch
            {
                //! _design = "標準";
                _design = "default";
            }

            try     {
                _unitPrice = int.Parse(XmlUtil.selectSingleNode(e, "price").InnerText);
            } catch {
                _unitPrice = 0;
            }

            _size = new SIZE(1, 1);

            _minHeight = 2;
            _maxHeight = 0;
        }