Exemple #1
0
        public static TypeNameAndClassSelector ForName(Selector previous, string name)
        {
            var result = new TypeNameAndClassSelector(previous);

            result.Name = name;
            return(result);
        }
Exemple #2
0
        public static TypeNameAndClassSelector ForClass(Selector previous, string className)
        {
            var result = new TypeNameAndClassSelector(previous);

            result.Classes.Add(className);
            return(result);
        }
 public static TypeNameAndClassSelector Is(Selector previous, Type targetType)
 {
     var result = new TypeNameAndClassSelector(previous);
     result._targetType = targetType;
     result.IsConcreteType = false;
     return result;
 }
Exemple #4
0
        public static TypeNameAndClassSelector Is(Selector previous, Type targetType)
        {
            var result = new TypeNameAndClassSelector(previous);

            result._targetType    = targetType;
            result.IsConcreteType = false;
            return(result);
        }
        /// <summary>
        /// Returns a selector which matches a control's Name.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="name">The name.</param>
        /// <returns>The selector.</returns>
        public static Selector Name(this Selector previous, string name)
        {
            var tac = previous as TypeNameAndClassSelector;

            if (tac != null)
            {
                tac.Name = name;
                return(tac);
            }
            else
            {
                return(TypeNameAndClassSelector.ForName(previous, name));
            }
        }
        /// <summary>
        /// Returns a selector which matches a control's style class.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="name">The name of the style class.</param>
        /// <returns>The selector.</returns>
        public static Selector Class(this Selector previous, string name)
        {
            var tac = previous as TypeNameAndClassSelector;

            if (tac != null)
            {
                tac.Classes.Add(name);
                return(tac);
            }
            else
            {
                return(TypeNameAndClassSelector.ForClass(previous, name));
            }
        }
Exemple #7
0
        /// <summary>
        /// Returns a selector which matches a control's Name.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="name">The name.</param>
        /// <returns>The selector.</returns>
        public static Selector Name(this Selector previous, string name)
        {
            Contract.Requires <ArgumentNullException>(name != null);
            Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(name));

            var tac = previous as TypeNameAndClassSelector;

            if (tac != null)
            {
                tac.Name = name;
                return(tac);
            }
            else
            {
                return(TypeNameAndClassSelector.ForName(previous, name));
            }
        }
Exemple #8
0
        /// <summary>
        /// Returns a selector which matches a control's Name.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="name">The name.</param>
        /// <returns>The selector.</returns>
        public static Selector Name(this Selector?previous, string name)
        {
            _ = name ?? throw new ArgumentNullException(nameof(name));

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Name may not be empty", nameof(name));
            }

            var tac = previous as TypeNameAndClassSelector;

            if (tac != null)
            {
                tac.Name = name;
                return(tac);
            }
            else
            {
                return(TypeNameAndClassSelector.ForName(previous, name));
            }
        }
Exemple #9
0
        /// <summary>
        /// Returns a selector which matches a type or a derived type.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="type">The type.</param>
        /// <returns>The selector.</returns>
        public static Selector Is(this Selector previous, Type type)
        {
            Contract.Requires <ArgumentNullException>(type != null);

            return(TypeNameAndClassSelector.Is(previous, type));
        }
Exemple #10
0
        /// <summary>
        /// Returns a selector which matches a type or a derived type.
        /// </summary>
        /// <param name="previous">The previous selector.</param>
        /// <param name="type">The type.</param>
        /// <returns>The selector.</returns>
        public static Selector Is(this Selector?previous, Type type)
        {
            _ = type ?? throw new ArgumentNullException(nameof(type));

            return(TypeNameAndClassSelector.Is(previous, type));
        }
 /// <summary>
 /// Returns a selector which matches a type or a derived type.
 /// </summary>
 /// <param name="previous">The previous selector.</param>
 /// <param name="type">The type.</param>
 /// <returns>The selector.</returns>
 public static Selector Is(this Selector previous, Type type)
 {
     return(TypeNameAndClassSelector.Is(previous, type));
 }
 public static TypeNameAndClassSelector ForClass(Selector previous, string className)
 {
     var result = new TypeNameAndClassSelector(previous);
     result.Classes.Add(className);
     return result;
 }
 public static TypeNameAndClassSelector ForName(Selector previous, string name)
 {
     var result = new TypeNameAndClassSelector(previous);
     result.Name = name;
     return result;
 }