Пример #1
0
        private void ResolveTypeName(string longName)
        {
            string       error;
            XamlTypeName typeName = XamlTypeName.ParseInternal(longName, _context.FindNamespaceByPrefix, out error);

            if (typeName == null)
            {
                throw new XamlParseException(this, error);
            }

            // In curly form, we search for TypeName + 'Extension' before TypeName
            string bareTypeName = typeName.Name;

            typeName.Name = typeName.Name + KnownStrings.Extension;
            XamlType xamlType = _context.GetXamlType(typeName, false);

            // This would be cleaner if we moved the Extension fallback logic out of XSC
            if (xamlType == null ||
                // Guard against Extension getting added twice
                (xamlType.UnderlyingType != null &&
                 KS.Eq(xamlType.UnderlyingType.Name, typeName.Name + KnownStrings.Extension)))
            {
                typeName.Name = bareTypeName;
                xamlType      = _context.GetXamlType(typeName, true);
            }

            _tokenXamlType  = xamlType;
            _tokenNamespace = typeName.Namespace;
        }
Пример #2
0
        private void ResolveTypeName(string longName)
        {
            string       error;
            XamlTypeName typeName = XamlTypeName.ParseInternal(longName, _context.FindNamespaceByPrefix, out error);

            if (typeName == null)
            {
                throw new XamlParseException(this, error);
            }
            var xamlType = typeName;

            // Original System.Xaml resolves types in the tokenizer, we don't

            /*
             *
             * // In curly form, we search for TypeName + 'Extension' before TypeName
             * string bareTypeName = typeName.Name;
             * typeName.Name = typeName.Name + KnownStrings.Extension;
             *
             * XamlType xamlType = _context.GetXamlType(typeName, false);
             * // This would be cleaner if we moved the Extension fallback logic out of XSC
             * if (xamlType == null ||
             *  // Guard against Extension getting added twice
             *  (xamlType.UnderlyingType != null &&
             *   KS.Eq(xamlType.UnderlyingType.Name, typeName.Name + KnownStrings.Extension)))
             * {
             *  typeName.Name = bareTypeName;
             *  xamlType = _context.GetXamlType(typeName, true);
             * }*/

            _tokenXamlType  = xamlType;
            _tokenNamespace = typeName.Namespace;
        }
        internal XamlType ResolveXamlType(string qName, bool skipVisibilityCheck)
        {
            string       str;
            XamlTypeName typeName = XamlTypeName.ParseInternal(qName, this.ResolvePrefixCachedDelegate, out str);

            if (typeName == null)
            {
                throw new XamlParseException(str);
            }
            return(this.GetXamlType(typeName, false, skipVisibilityCheck));
        }
        private void ResolveTypeName(string longName)
        {
            string       str;
            XamlTypeName typeName = XamlTypeName.ParseInternal(longName, new Func <string, string>(this._context.FindNamespaceByPrefix), out str);

            if (typeName == null)
            {
                throw new XamlParseException(this, str);
            }
            string name = typeName.Name;

            typeName.Name = typeName.Name + "Extension";
            XamlType xamlType = this._context.GetXamlType(typeName, false);

            if ((xamlType == null) || ((xamlType.UnderlyingType != null) && KS.Eq(xamlType.UnderlyingType.Name, typeName.Name + "Extension")))
            {
                typeName.Name = name;
                xamlType      = this._context.GetXamlType(typeName, true);
            }
            this._tokenXamlType  = xamlType;
            this._tokenNamespace = typeName.Namespace;
        }