コード例 #1
0
        /// <summary>
        /// Save component properties to a property bag.
        /// </summary>
        /// <param name="propertyBag">Property bag</param>
        /// <param name="clearDirty">Clear dirty flag</param>
        /// <param name="saveAllProperties">Save all properties flag</param>
        protected override void SaveProperties(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
        {
            this.WritePropertyValue(propertyBag, RAISE_XPATH_EXCEPTIONS_PROP_NAME, this.RaiseXPathExceptions);

            string xml = null;

            if (this.XPathProperties != null)
            {
                XPathPropertySerializer serializer = new XPathPropertySerializer(this.XPathProperties);
                xml = serializer.Serialize();
            }
            this.WritePropertyValue(propertyBag, PROPERTIES_PROP_NAME, xml);
        }
コード例 #2
0
        /// <summary>
        /// Load component properties from a property bag.
        /// </summary>
        /// <param name="propertyBag">Property bag</param>
        /// <param name="errorLog">Error log level</param>
        protected override void LoadProperties(IPropertyBag propertyBag, int errorLog)
        {
            this.RaiseXPathExceptions = this.ReadPropertyValue <bool>(propertyBag, RAISE_XPATH_EXCEPTIONS_PROP_NAME, this.RaiseXPathExceptions);

            string xml = this.ReadPropertyValue <string>(propertyBag, PROPERTIES_PROP_NAME, null);

            if (string.IsNullOrEmpty(xml) == false)
            {
                XPathPropertySerializer serializer = new XPathPropertySerializer();
                serializer.Deserialize(xml);
                this.XPathProperties = serializer.Properties;
            }
        }