Example #1
0
        public override void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id    = xmlDoc.GetAttributeObject("Id");
            this.Text  = xmlDoc.GetAttributeObject("Text");
            this.Value = xmlDoc.GetAttributeObject("Value");
        }
Example #2
0
        public override void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id   = xmlDoc.GetAttributeObject("Id");
            this.Name = xmlDoc.GetAttributeObject("Name");
            this.Code = xmlDoc.GetAttributeObject("Code");
        }
        public void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id     = xmlDoc.GetAttributeObject("Id");
            this.Name   = xmlDoc.GetAttributeObject("Name");
            this.Parent = xmlDoc.GetAttributeObject("Parent");
        }
Example #4
0
        public virtual void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id     = xmlDoc.GetAttributeObject("Id");
            this.Name   = xmlDoc.GetAttributeObject("Name");
            this.Code   = xmlDoc.GetAttributeObject("Code");
            this.Sys    = xmlDoc.GetAttributeObject <bool>("Sys", false);
            this.Remark = xmlDoc.GetInnerObject("/Remark");
        }
Example #5
0
        public virtual void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id        = xmlDoc.GetAttributeObject("Id");
            this.Name      = xmlDoc.GetAttributeObject("Name");
            this.Code      = xmlDoc.GetAttributeObject("Code");
            this.Sys       = xmlDoc.GetAttributeObject <bool>("Sys", false);
            this.EventTime = xmlDoc.GetAttributeObject <int>("EventTime", 0);
        }
Example #6
0
        /// <summary>
        /// 根据xml字串构建元素对象
        /// 这里完成共有部分,其余由继承的类具体实现
        /// </summary>
        /// <param name="strXml"></param>
        public override void FromXml(string strXml)
        {
            base.FromXml(strXml);

            SEXElement xmlDoc = SEXElement.Parse(strXml);

            //设置参数
            this.Enabled = xmlDoc.GetInnerObject <bool>("/Enabled", true);
            this.Visible = xmlDoc.GetInnerObject <bool>("/Visible", true);
            this.Size    = new Size(xmlDoc.GetInnerObject <int>("/Width", 0), xmlDoc.GetInnerObject <int>("/Height", 0));

            //FormXml的时候不需要ControlType,因为在调用FormXml的时候,对象必然已经被实例化,对象类型已知了
            //this.ControlType = FormElementEntityTypes.GetProvideAttribute(xmlDoc.GetInnerObject<int>(XmlRootName + "/ControlType", -0));
            this.Text = xmlDoc.GetInnerObject("/Text");

            this.BackColorValue = xmlDoc.GetAttributeObject("/BackColorValue/Color", "Value");
            this.ForeColorValue = xmlDoc.GetAttributeObject("/ForeColorValue/Color", "Value");

            this.TabIndex = xmlDoc.GetInnerObject <int>("/TabIndex", 0);
            this.ZOrder   = xmlDoc.GetInnerObject <int>("/ZOrder", 0);

            //有些窗体元素没有这个属性,比如工具栏项目,就用默认
            this.Location = new Point(xmlDoc.GetInnerObject <int>("/Left", 0), xmlDoc.GetInnerObject <int>("/Top", 0));

            //设置锚定部分
            //有些窗体元素没有这个属性,比如工具栏项目,就用默认
            this.Anchor.Top    = xmlDoc.GetInnerObject <bool>("/Anchor/Top", true);
            this.Anchor.Bottom = xmlDoc.GetInnerObject <bool>("/Anchor/Bottom", false);
            this.Anchor.Left   = xmlDoc.GetInnerObject <bool>("/Anchor/Left", true);
            this.Anchor.Right  = xmlDoc.GetInnerObject <bool>("/Anchor/Right", false);

            if (xmlDoc.SelectSingleNode("/Font").HasElements)
            {
                this.Font = new UIElementFont();
                this.Font.FromXml(xmlDoc.GetOuterXml("/Font"));
            }



            //添加事件对象
            EventBase eventBase;

            foreach (XElement eventNode in xmlDoc.SelectNodes("/Events/Event"))
            {
                eventBase = this.EventTypesAdapter.CreateInstance(Convert.ToInt32(eventNode.Attribute("EventCode").Value));
                eventBase.FromXml(eventNode.ToString());
                this.Events.Add(eventBase);
            }
        }
        /// <summary>
        /// 由XML构造对象
        /// </summary>
        /// <param name="strXml"></param>
        public override void FromXml(string strXml)
        {
            base.FromXml(strXml);

            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Width        = xmlDoc.GetInnerObject <int>("/Width", 0);
            this.Height       = xmlDoc.GetInnerObject <int>("/Height", 0);
            this.ClientWidth  = xmlDoc.GetInnerObject <int>("/ClientWidth", 0);
            this.ClientHeight = xmlDoc.GetInnerObject <int>("/ClientHeight", 0);
            this.WindowState  = (EnumFormWindowState)xmlDoc.GetInnerObject <int>("/OpenState", 0);
            this.FolderId     = xmlDoc.GetInnerObject("/Folder");

            this.Text           = xmlDoc.GetInnerObject("/Text");
            this.BackColorValue = xmlDoc.GetAttributeObject("/BackColorValue/Color", "Value");
            this.ForeColorValue = xmlDoc.GetAttributeObject("/ForeColorValue/Color", "Value");

            if (xmlDoc.SelectSingleNode("/Font").HasElements)
            {
                this.Font = new UIElementFont();
                this.Font.FromXml(xmlDoc.GetOuterXml("/Font"));
            }

            //添加动作对象
            EventBase eventBase;

            foreach (XElement eventNode in xmlDoc.SelectNodes("/Events/Event"))
            {
                eventBase = this.EventTypesAdapter.CreateInstance(Convert.ToInt32(eventNode.Attribute("EventCode").Value));
                eventBase.FromXml(eventNode.ToString());
                eventBase.HostFormEntity = this;
                this.Events.Add(eventBase);
            }

            //添加元素对象
            UIElement formElement;

            foreach (XElement elementNode in xmlDoc.SelectNodes("/Elements/Element"))
            {
                formElement = (UIElement)this.FormElementEntityTypesAdapter.CreateInstance(
                    Convert.ToInt32(elementNode.Element("ControlType").Value));
                Debug.Assert(formElement != null, "创建 FormEntity 时,FormElement 没创建出来");
                formElement.FromXml(elementNode.ToString());
                formElement.HostFormEntity = this;
                this.Elements.Add(formElement);
            }
        }
Example #8
0
        public void FromXml(string strXml)
        {
            SEXElement xmlSummary = SEXElement.Parse(strXml);

            _version        = xmlSummary.GetAttributeObject <int>("Version", 0);
            _productVersion = xmlSummary.GetInnerObject("/ProductVersion");
            _firstRun       = xmlSummary.GetInnerObject <bool>("/FirstRun", false);
        }
Example #9
0
        public override void FromXml(string strXml)
        {
            base.FromXml(strXml);
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Field = DataBaseProvide.Current.FieldFactory.CreateInstance(xmlDoc.GetAttributeObject <int>("ItemCode", 0));
            SetLengthXml(xmlDoc.SelectSingleNode("Length"));
            this.DefaultValue = xmlDoc.GetInnerObject("DefaultValue");
            this.AllowEmpty   = xmlDoc.GetInnerObject <bool>("AllowEmpty", true);
            this.Exclusive    = xmlDoc.GetInnerObject <bool>("Exclusive", false);
        }
        public override void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.Id               = xmlDoc.GetAttributeObject("Id");
            this.Name             = xmlDoc.GetAttributeObject("Name");
            this.Code             = xmlDoc.GetAttributeObject("Code");
            this.Text             = xmlDoc.GetInnerObject("/Text");
            this.Width            = xmlDoc.GetInnerObject <int>("/Width", 100);
            this.Remark           = xmlDoc.GetInnerObject("/Remark");
            this.IsBind           = xmlDoc.GetInnerObject <bool>("/IsBind", false);
            this.DataItemId       = xmlDoc.GetInnerObject("/DataItemId");
            this.DataPropertyName = xmlDoc.GetInnerObject("/DataPropertyName");
            this.Visible          = xmlDoc.GetInnerObject <bool>("/Visible", true);
            this.DataRule         = DataRuleTypesAdapter.CreateInstance(xmlDoc.GetAttributeObject <int>("/DataRule", "Type", 0));
            Debug.Assert(this.DataRule != null, "������DataRuleδ�ܳ�ʼ��");
            if (this.DataRule != null)
            {
                this.DataRule.FromXml(xmlDoc.SelectSingleNode("/DataRule").ToString());
            }
        }
Example #11
0
        public virtual void FromXml(string xml)
        {
            Debug.Assert(String.IsNullOrEmpty(xml) == false, "xml 为 空");
            if (String.IsNullOrEmpty(xml))
            {
                return;
            }
            SEXElement element = SEXElement.Parse(xml);

            this.Id     = element.Attribute("Id").Value;
            this.Name   = element.Attribute("Name").Value;
            this.Code   = element.Attribute("Code").Value;
            this.System = element.GetAttributeObject <bool>("Sys", false);
        }
        public override void FromXml(string strXml)
        {
            base.FromXml(strXml);
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this.GroupId     = xmlDoc.GetAttributeObject("GroupId");
            this.ToolTipText = xmlDoc.GetInnerObject("/ToolTipText");
            this.Text        = xmlDoc.GetInnerObject("/Text");
            EventBase eventBase;

            foreach (XElement eventNode in xmlDoc.SelectNodes("/Events/Event"))
            {
                eventBase = this.EventTypesAdapter.CreateInstance(Convert.ToInt32(eventNode.Attribute("EventCode").Value));
                eventBase.FromXml(eventNode.ToString());
                this.Events.Add(eventBase);
            }
        }
        public void FromXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);

            this._name = xmlDoc.GetAttributeObject("Name");
            this._type = (ChooseColorType)xmlDoc.GetAttributeObject <int>("Type", 0);
            int a = xmlDoc.GetAttributeObject <int>("A", 0);
            int r = xmlDoc.GetAttributeObject <int>("R", 0);
            int g = xmlDoc.GetAttributeObject <int>("G", 0);
            int b = xmlDoc.GetAttributeObject <int>("B", 0);

            this._color = Color.FromArgb(a, r, g, b);
        }
Example #14
0
        public static EventBase GetEventDevByXml(string strXml)
        {
            SEXElement xmlDoc = SEXElement.Parse(strXml);
            EventBase  even   = EventDevTypes.Instance.CreateInstance(Convert.ToInt32(xmlDoc.GetAttributeObject("Event", "EventCode")));

            even.FromXml(strXml);
            return(even);
        }