protected virtual MvxChainedSourceBinding CreateChainedBinding(object source, MvxPropertyToken propertyToken,
                                                                       List<MvxPropertyToken> remainingTokens)
        {
            var indexPropertyToken = propertyToken as MvxIndexerPropertyToken;
            if (indexPropertyToken != null)
            {
                var itemPropertyInfo = this.FindPropertyInfo(source);
                if (itemPropertyInfo == null)
                    return null;

                return new MvxIndexerChainedSourceBinding(source, itemPropertyInfo, indexPropertyToken,
                                                          remainingTokens);
            }

            var propertyNameToken = propertyToken as MvxPropertyNamePropertyToken;
            if (propertyNameToken != null)
            {
                var propertyInfo = this.FindPropertyInfo(source, propertyNameToken.PropertyName);

                if (propertyInfo == null)
                    return null;

                return new MvxSimpleChainedSourceBinding(source, propertyInfo,
                                                         remainingTokens);
            }

            throw new MvxException("Unexpected property chaining - seen token type {0}",
                                   propertyToken.GetType().FullName);
        }
Exemplo n.º 2
0
        protected virtual MvxChainedSourceBinding CreateChainedBinding(object source, MvxPropertyToken propertyToken,
                                                                       List <MvxPropertyToken> remainingTokens)
        {
            var indexPropertyToken = propertyToken as MvxIndexerPropertyToken;

            if (indexPropertyToken != null)
            {
                var itemPropertyInfo = FindPropertyInfo(source);
                if (itemPropertyInfo == null)
                {
                    return(null);
                }

                return(new MvxIndexerChainedSourceBinding(source, itemPropertyInfo, indexPropertyToken,
                                                          remainingTokens));
            }

            var propertyNameToken = propertyToken as MvxPropertyNamePropertyToken;

            if (propertyNameToken != null)
            {
                var propertyInfo = FindPropertyInfo(source, propertyNameToken.PropertyName);

                if (propertyInfo == null)
                {
                    return(null);
                }

                return(new MvxSimpleChainedSourceBinding(source, propertyInfo,
                                                         remainingTokens));
            }

            throw new MvxException("Unexpected property chaining - seen token type {0}",
                                   propertyToken.GetType().FullName);
        }
        private static MvxChainedSourceBinding CreateChainedBinding(object source, MvxPropertyToken propertyToken,
                                                                    List <MvxPropertyToken> remainingTokens)
        {
            if (propertyToken is MvxIndexerPropertyToken)
            {
                return(new MvxIndexerChainedSourceBinding(source, (MvxIndexerPropertyToken)propertyToken,
                                                          remainingTokens));
            }
            else if (propertyToken is MvxPropertyNamePropertyToken)
            {
                return(new MvxSimpleChainedSourceBinding(source, (MvxPropertyNamePropertyToken)propertyToken,
                                                         remainingTokens));
            }

            throw new MvxException("Unexpected property chaining - seen token type {0}",
                                   propertyToken.GetType().FullName);
        }
        private static MvxChainedSourceBinding CreateChainedBinding(object source, MvxPropertyToken propertyToken,
                                                                    List<MvxPropertyToken> remainingTokens)
        {
            if (propertyToken is MvxIndexerPropertyToken)
            {
                return new MvxIndexerChainedSourceBinding(source, (MvxIndexerPropertyToken) propertyToken,
                                                          remainingTokens);
            }
            else if (propertyToken is MvxPropertyNamePropertyToken)
            {
                return new MvxSimpleChainedSourceBinding(source, (MvxPropertyNamePropertyToken) propertyToken,
                                                         remainingTokens);
            }

            throw new MvxException("Unexpected property chaining - seen token type {0}",
                                   propertyToken.GetType().FullName);
        }
Exemplo n.º 5
0
        protected virtual IMvxSourceBinding CreateLeafBinding(object source, MvxPropertyToken propertyToken)
        {
            var indexPropertyToken = propertyToken as MvxIndexerPropertyToken;

            if (indexPropertyToken != null)
            {
                var itemPropertyInfo = FindPropertyInfo(source);
                if (itemPropertyInfo == null)
                {
                    return(null);
                }
                return(new MvxIndexerLeafPropertyInfoSourceBinding(source, itemPropertyInfo, indexPropertyToken));
            }

            var propertyNameToken = propertyToken as MvxPropertyNamePropertyToken;

            if (propertyNameToken != null)
            {
                var propertyInfo = FindPropertyInfo(source, propertyNameToken.PropertyName);
                if (propertyInfo == null)
                {
                    return(null);
                }
                return(new MvxSimpleLeafPropertyInfoSourceBinding(source, propertyInfo));
            }

            if (propertyToken is MvxEmptyPropertyToken)
            {
                return(new MvxDirectToSourceBinding(source));
            }

            throw new MvxException("Unexpected property source - seen token type {0}", propertyToken.GetType().FullName);
        }
        protected virtual IMvxSourceBinding CreateLeafBinding(object source, MvxPropertyToken propertyToken)
        {
            var indexPropertyToken = propertyToken as MvxIndexerPropertyToken;
            if (indexPropertyToken != null)
            {
                var itemPropertyInfo = this.FindPropertyInfo(source);
                if (itemPropertyInfo == null)
                    return null;
                return new MvxIndexerLeafPropertyInfoSourceBinding(source, itemPropertyInfo, indexPropertyToken);
            }

            var propertyNameToken = propertyToken as MvxPropertyNamePropertyToken;
            if (propertyNameToken != null)
            {
                var propertyInfo = this.FindPropertyInfo(source, propertyNameToken.PropertyName);
                if (propertyInfo == null)
                    return null;
                return new MvxSimpleLeafPropertyInfoSourceBinding(source, propertyInfo);
            }

            if (propertyToken is MvxEmptyPropertyToken)
            {
                return new MvxDirectToSourceBinding(source);
            }

            throw new MvxException("Unexpected property source - seen token type {0}", propertyToken.GetType().FullName);
        }
        private static IMvxSourceBinding CreateLeafBinding(object source, MvxPropertyToken propertyToken)
        {
            if (propertyToken is MvxIndexerPropertyToken)
            {
                return(new MvxIndexerLeafPropertyInfoSourceBinding(source, (MvxIndexerPropertyToken)propertyToken));
            }
            else if (propertyToken is MvxPropertyNamePropertyToken)
            {
                return(new MvxSimpleLeafPropertyInfoSourceBinding(source, (MvxPropertyNamePropertyToken)propertyToken));
            }
            else if (propertyToken is MvxEmptyPropertyToken)
            {
                return(new MvxDirectToSourceBinding(source));
            }

            throw new MvxException("Unexpected property source - seen token type {0}", propertyToken.GetType().FullName);
        }
        private static IMvxSourceBinding CreateLeafBinding(object source, MvxPropertyToken propertyToken)
        {
            if (propertyToken is MvxIndexerPropertyToken)
            {
                return new MvxIndexerLeafPropertyInfoSourceBinding(source, (MvxIndexerPropertyToken) propertyToken);
            }
            else if (propertyToken is MvxPropertyNamePropertyToken)
            {
                return new MvxSimpleLeafPropertyInfoSourceBinding(source, (MvxPropertyNamePropertyToken) propertyToken);
            }
            else if (propertyToken is MvxEmptyPropertyToken)
            {
                return new MvxDirectToSourceBinding(source);
            }

            throw new MvxException("Unexpected property source - seen token type {0}", propertyToken.GetType().FullName);
        }