Пример #1
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var image = value.ToImage();

            if (image != null)
            {
                _image = image;
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var image = value.ToImage();

            if (image != null)
            {
                _images.Clear();
                _images.Add(image);
            }
            else if (value is CSSValueList)
            {
                var values = (CSSValueList)value;
                var images = new List <ICssObject>();

                for (int i = 0; i < values.Length; i++)
                {
                    image = values[i].ToImage();

                    if (image == null || (++i < values.Length && values[i] != CSSValue.Separator))
                    {
                        return(false);
                    }

                    images.Add(image);
                }

                _images.Clear();
                _images.AddRange(images);
            }
            else
            {
                return(false);
            }

            return(true);
        }