public TextControl(string visible, string enabled, string value = null, string hint = null, string pattern = null,
                    TextRestriction restriction = TextRestriction.None)
     : base(visible, enabled)
 {
     Value       = value ?? string.Empty;
     Hint        = hint ?? string.Empty;
     Pattern     = pattern ?? string.Empty;
     Restriction = restriction;
 }
        public TextViewModel(string key, string label, string required, TextControl control)
            : base(key, label, required, control)
        {
            _control = control;

            _width       = 300;
            _pattern     = control.Pattern;
            _restriction = control.Restriction;
            _hint        = control.Hint;
        }
Ejemplo n.º 3
0
            private IRestriction fromTextRestriction(TextRestriction res)
            {
                string value = res.Value ?? "";

                if (res.ExactMatch)
                {
                    return(RestrictionFactory.Eq(_configuredSearch.ObjectType, res.Property, value));
                }
                else
                {
                    return(RestrictionFactory.Like(_configuredSearch.ObjectType, res.Property, string.Format("%{0}%", value.Trim('%'))));
                }
            }
        private static textRestriction Translate(TextRestriction from)
        {
            textRestriction to;

            switch (from)
            {
            case TextRestriction.None:
            {
                to = textRestriction.none;
                break;
            }

            case TextRestriction.IPv4:
            {
                to = textRestriction.ipv4;
                break;
            }

            case TextRestriction.IPv6:
            {
                to = textRestriction.ipv6;
                break;
            }

            case TextRestriction.Number:
            {
                to = textRestriction.number;
                break;
            }

            case TextRestriction.Port:
            {
                to = textRestriction.port;
                break;
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(from), from, null);
            }

            return(to);
        }