コード例 #1
0
        public Func <IOpenSearchResultItem, bool> GetItemValidator(OpenSearchParameter parameter)
        {
            var labelString = LabelStrings.FirstOrDefault(ls => ls.Value == parameter.Value);

            if (labelString == null)
            {
                return(null);
            }
            return(labelString.Validator);
        }
コード例 #2
0
        public Func <IOpenSearchResultItem, bool> GetItemValidator(OpenSearchParameter parameter)
        {
            if (ItemValueValidator == null)
            {
                return(null);
            }

            IEnumerable <double> values = ParseFilterValue(parameter.Value);

            if (values == null)
            {
                return(null);
            }
            return(ItemValueValidator.Invoke(values.ToArray()));
        }
コード例 #3
0
        internal Func <IOpenSearchResultItem, bool> GetItemValidator(OpenSearchParameter parameter)
        {
            IEnumerable <System.Reflection.PropertyInfo> props = this.GetType().GetProperties().Where(
                prop => Attribute.IsDefined(prop, typeof(SimpleChoiceAttribute)) || Attribute.IsDefined(prop, typeof(ComplexChoiceAttribute)));

            foreach (var prop in props)
            {
                try
                {
                    IMissionFilter filter = prop.GetValue(this) as IMissionFilter;
                    if (filter.FullName != parameter.FullName)
                    {
                        continue;
                    }
                    return(filter.GetItemValidator(parameter));
                }
                catch
                {
                    continue;
                }
            }

            return(null);
        }