public void Deserialize(XElement node, XmlDeserializeContext context)
 {
     this.Name             = node.Attribute("_na", this.Name);
     this.DisplayName      = node.Attribute("_dn", this.DisplayName);
     this.Columns          = node.Attribute("_columns", this.Columns);
     this.DefaultRowHeight = node.Attribute("_drh", this.DefaultRowHeight);
 }
        public void Deserialize(XElement node, XmlDeserializeContext context)
        {
            this.Clear();
            var itemNodes = from vNodes in node.Descendants("I")
                            select vNodes;

            if (itemNodes.FirstOrDefault() == null)
            {
                itemNodes = from vNodes in node.Descendants("Item")
                            select vNodes;
            }
            foreach (XElement itemNode in itemNodes)
            {
                PropertyLayout pl = new PropertyLayout();
                pl.Deserialize(itemNode, context);
                this.Add(pl);
            }
            string idList = node.Attribute("_pvs", string.Empty);

            if (!idList.IsNullOrEmpty())
            {
                string[] idArray = idList.Split(',');
                foreach (string id in idArray)
                {
                    XElement element = new XElement("Custom");
                    element.SetAttributeValue("v", id);
                    PropertyLayout pl = new PropertyLayout();
                    pl.Deserialize(element, context);
                    this.Add(pl);
                }
            }
        }
Exemple #3
0
        public void Deserialize(XElement node, XmlDeserializeContext context)
        {
            object pv = null;

            int objID = node.Attribute("v", -1);

            if (context.ObjectContext.TryGetValue(objID, out pv) == true)
            {
                this._Definition = ((PropertyValue)pv).Clone().Definition;
            }
            else
            {
                this._Definition = new PropertyDefine();
                this._Definition.Deserialize(node, context);

                objID = node.Attribute("id", -1);
                if (objID > -1)
                {
                    context.ObjectContext.Add(objID, this);
                }
            }

            string sv = node.Attribute("_sv", this._StringValue);

            if (string.IsNullOrEmpty(sv))
            {
                this._StringValue = this._Definition.DefaultValue;
            }
            else
            {
                this._StringValue = sv;
            }
        }
Exemple #4
0
        public virtual void Deserialize(XElement node, XmlDeserializeContext context)
        {
            this.Name                    = node.Attribute("_n", this.Name);
            this.DisplayName             = node.Attribute("_dn", this.DisplayName);
            this.Category                = node.Attribute("_category", this.Category);
            this._DataType               = node.Attribute("_dataType", PropertyDataType.String);
            this.DefaultValue            = node.Attribute("_dv", this.DefaultValue);
            this.Description             = node.Attribute("_desp", this.Description);
            this.EditorKey               = node.Attribute("_eKey", this.EditorKey);
            this.PersisterKey            = node.Attribute("_perKey", this.PersisterKey);
            this.EditorParamsSettingsKey = node.Attribute("_ePS", this.EditorParamsSettingsKey);
            this.EditorParams            = node.Attribute("_eP", this.EditorParams);
            this.ReadOnly                = node.Attribute("_ro", false);
            this.Visible                 = node.Attribute("_visible", true);
            this.AllowOverride           = node.Attribute("_override", true);
            this.SortOrder               = node.Attribute("_sortOrder", 0);
            this.MaxLength               = node.Attribute("_ml", 0);
            this.IsRequired              = node.Attribute("_isRequired", false);
            this.ShowTitle               = node.Attribute("_showTitle", true);

            if (node.HasElements)
            {
                if (this._Validators == null)
                {
                    this._Validators = new PropertyValidatorDescriptorCollection();
                }
                else
                {
                    this._Validators.Clear();
                }

                this._Validators.Deserialize(node, context);
            }
        }
        public void Deserialize(System.Xml.Linq.XElement node, XmlDeserializeContext context)
        {
            IEnumerable <XElement> nodes = node.Descendants("pvDesp");

            foreach (XElement item in nodes)
            {
                PropertyValidatorDescriptor pvDesp = new PropertyValidatorDescriptor();
                pvDesp.Deserialize(item, context);

                this.Add(pvDesp);
            }
        }
        public void Deserialize(System.Xml.Linq.XElement node, XmlDeserializeContext context)
        {
            this.Name            = node.Attribute("_N", this.Name);
            this.MessageTemplate = node.Attribute("_MT", this.MessageTemplate);
            this.Tag             = node.Attribute("_tag", this.Tag);
            this.TypeDescription = node.Attribute("_TD", this.TypeDescription);

            if (node.HasElements)
            {
                this._Parameters = new PropertyValidatorParameterDescriptorCollection();
                this._Parameters.Deserialize(node, context);
            }
        }
Exemple #7
0
        /// <summary>
        /// 为通用的序列化而显示实现接口IXElementSerializable
        /// </summary>
        /// <param name="node"></param>
        /// <param name="context"></param>
        void IXElementSerializable.Deserialize(XElement node, XmlDeserializeContext context)
        {
            this._Definition = new PropertyDefine();
            this._Definition.Deserialize(node, context);

            string sv = node.Attribute("_sv", this._StringValue);

            if (string.IsNullOrEmpty(sv))
            {
                this._StringValue = this._Definition.DefaultValue;
            }
            else
            {
                this._StringValue = sv;
            }
        }
Exemple #8
0
 void IXElementSerializable.Deserialize(System.Xml.Linq.XElement node, XmlDeserializeContext context)
 {
     this.Name        = node.Attribute(ns + "name", string.Empty);
     this.Description = node.Attribute(ns + "desc", string.Empty);
     this.InitFromConfiguration(UserRecentDataConfigurationSection.GetConfig().Categories[this.Name]);
     if (node.HasElements)
     {
         var items = node.Element(ns + "items");
         if (items != null)
         {
             foreach (var item in items.Elements(ns + "item"))
             {
                 PropertyValueCollection value = new PropertyValueCollection();
                 value.Deserialize(item, context);
                 this.Items.Add(value);
             }
         }
     }
 }
Exemple #9
0
        public void PropertyValueSerializeTest()
        {
            PropertyValue pv = PreparePropertyValue();

            XElementFormatter   formatter = new XElementFormatter();
            XmlSerializeContext context   = new XmlSerializeContext();
            XElement            root      = new XElement("root");

            pv.Serialize(root, context);

            Console.WriteLine(root.ToString());

            XmlDeserializeContext dcontext         = new XmlDeserializeContext();
            PropertyValue         newPropertyValue = new PropertyValue(new PropertyDefine());

            newPropertyValue.Deserialize(root, dcontext);

            //Assert.AreEqual(root.ToString(), rootReserialized.ToString());
            Assert.AreEqual(pv.StringValue, newPropertyValue.StringValue);
            Assert.AreEqual(pv.Definition.Name, newPropertyValue.Definition.Name);
        }
        public void Deserialize(XElement node, XmlDeserializeContext context)
        {
            object pv    = null;
            int    objID = node.Attribute("v", -1);

            if (context.ObjectContext.TryGetValue(objID, out pv) == true)
            {
                this._LayoutSection = ((PropertyLayout)pv).Clone().LayoutSection;
            }
            else
            {
                this._LayoutSection = new PropertyLayoutSectionDefine();
                this._LayoutSection.Deserialize(node, context);

                objID = node.Attribute("id", -1);
                if (objID > -1)
                {
                    context.ObjectContext.Add(objID, this);
                }
            }
        }
Exemple #11
0
 public void Deserialize(System.Xml.Linq.XElement node, XmlDeserializeContext context)
 {
     throw new NotImplementedException();
     //参考MCS.Library.SOA.DataObjects.PropertyDefine
 }
Exemple #12
0
 public void AfterDeserialize(XmlDeserializeContext context)
 {
     this.MergeDefinedProperties();
 }
 public void Deserialize(System.Xml.Linq.XElement node, XmlDeserializeContext context)
 {
     this.ParamName  = node.Attribute("_parName", this.ParamName);
     this.DataType   = node.Attribute("_dType", PropertyDataType.String);
     this.ParamValue = node.Attribute("_parV", this.ParamValue);
 }