Ejemplo n.º 1
0
        /// <summary>
        ///  Loads a <see cref="IBrush"/> from an XElement.
        /// </summary>
        /// <param name="element"> The source XElement. </param>
        /// <returns> The loaded <see cref="IBrush"/>. </returns>
        public static IBrush LoadBrush(XElement element)
        {
            BrushBase brush = new BrushBase();

            if (element.Attribute("Type") is XAttribute type)
            {
                brush.Type = XML.CreateBrushType(type.Value);
            }

            //Load
            {
                brush.Load(element);
            }

            return(brush);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Loads a <see cref="IBrush"/> from an XElement.
        /// </summary>
        /// <param name="element"> The source XElement. </param>
        /// <returns> The loaded <see cref="IBrush"/>. </returns>
        public static IBrush LoadBrush(XElement element)
        {
            BrushBase brush = new BrushBase();

            if (element.Attribute("Type") is XAttribute type)
            {
                try
                {
                    brush.Type = (BrushType)Enum.Parse(typeof(BrushType), type.Value);
                }
                catch (Exception) { }
            }

            // Load
            {
                brush.Load(element);
            }

            return(brush);
        }