Beispiel #1
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(XmlReader reader)
        {
            var doc = new XmlDocument();

            doc.Load(reader);
            if (doc.GetElementsByTagName("BackColor1").Count > 0)
            {
                BackColor1 = PaintUtility.GetColor(doc.GetElementsByTagName("BackColor1")[0].InnerText);
            }
            if (doc.GetElementsByTagName("BackColor2").Count > 0)
            {
                BackColor2 = PaintUtility.GetColor(doc.GetElementsByTagName("BackColor2")[0].InnerText);
            }
            if (doc.GetElementsByTagName("Gradient").Count > 0)
            {
                Gradient = Convert.ToInt32(doc.GetElementsByTagName("Gradient")[0].InnerText);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(XmlReader reader)
        {
            var doc = new XmlDocument();

            doc.Load(reader);

            if (doc.GetElementsByTagName("BackStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("BackStyle")[0].InnerXml + "</ColorPair>";
                BackStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("NormalBorder").Count > 0)
            {
                NormalBorder = PaintUtility.GetColor(doc.GetElementsByTagName("NormalBorder")[0].InnerText);
            }

            if (doc.GetElementsByTagName("DisabledMask").Count > 0)
            {
                DisabledMask = PaintUtility.GetColor(doc.GetElementsByTagName("DisabledMask")[0].InnerText);
            }

            if (doc.GetElementsByTagName("FocusedBorder").Count > 0)
            {
                FocusedBorder = PaintUtility.GetColor(doc.GetElementsByTagName("FocusedBorder")[0].InnerText);
            }

            if (doc.GetElementsByTagName("AppearanceBorder").Count > 0)
            {
                var xml = "<AppearanceBorder>" + doc.GetElementsByTagName("AppearanceBorder")[0].InnerXml +
                          "</AppearanceBorder>";
                AppearanceBorder.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }

            if (doc.GetElementsByTagName("CornerRadius").Count > 0)
            {
                CornerRadius = Convert.ToInt32(doc.GetElementsByTagName("CornerRadius")[0].InnerText);
            }
        }
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(XmlReader reader)
        {
            var doc = new XmlDocument();

            doc.Load(reader);

            if (doc.GetElementsByTagName("BackStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("BackStyle")[0].InnerXml + "</ColorPair>";
                BackStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("ClickStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("ClickStyle")[0].InnerXml + "</ColorPair>";
                ClickStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("HoverStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("HoverStyle")[0].InnerXml + "</ColorPair>";
                HoverStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("SelectedStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("SelectedStyle")[0].InnerXml + "</ColorPair>";
                SelectedStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("DisabledStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("DisabledStyle")[0].InnerXml + "</ColorPair>";
                DisabledStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("SelectedHoverStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("SelectedHoverStyle")[0].InnerXml + "</ColorPair>";
                SelectedHoverStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }


            if (doc.GetElementsByTagName("NormalBorder").Count > 0)
            {
                NormalBorder = PaintUtility.GetColor(doc.GetElementsByTagName("NormalBorder")[0].InnerText);
            }
            if (doc.GetElementsByTagName("HoverBorder").Count > 0)
            {
                HoverBorder = PaintUtility.GetColor(doc.GetElementsByTagName("HoverBorder")[0].InnerText);
            }
            if (doc.GetElementsByTagName("SelectedBorder").Count > 0)
            {
                SelectedBorder = PaintUtility.GetColor(doc.GetElementsByTagName("SelectedBorder")[0].InnerText);
            }
            if (doc.GetElementsByTagName("NormalForeGround").Count > 0)
            {
                NormalForeGround = PaintUtility.GetColor(doc.GetElementsByTagName("NormalForeGround")[0].InnerText);
            }
            if (doc.GetElementsByTagName("HoverForeGround").Count > 0)
            {
                HoverForeGround = PaintUtility.GetColor(doc.GetElementsByTagName("HoverForeGround")[0].InnerText);
            }

            if (doc.GetElementsByTagName("AppearenceText").Count > 0)
            {
                var xml = "<AppearenceText>" + doc.GetElementsByTagName("AppearenceText")[0].InnerXml +
                          "</AppearenceText>";
                AppearenceText.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }

            if (doc.GetElementsByTagName("SelectedForeGround").Count > 0)
            {
                SelectedForeGround = PaintUtility.GetColor(doc.GetElementsByTagName("SelectedForeGround")[0].InnerText);
            }
            if (doc.GetElementsByTagName("DisabledBorder").Count > 0)
            {
                DisabledBorder = PaintUtility.GetColor(doc.GetElementsByTagName("DisabledBorder")[0].InnerText);
            }
            if (doc.GetElementsByTagName("DisabledForeGround").Count > 0)
            {
                DisabledForeGround = PaintUtility.GetColor(doc.GetElementsByTagName("DisabledForeGround")[0].InnerText);
            }
            if (doc.GetElementsByTagName("Gradient").Count > 0)
            {
                Gradient = Convert.ToInt32(doc.GetElementsByTagName("Gradient")[0].InnerText);
            }
        }