示例#1
0
        protected internal virtual XamlType GetXamlType(string xamlNamespace, string name, params XamlType[] typeArguments)
        {
            if (xamlNamespace == null)
            {
                throw new ArgumentNullException("xamlNamespace");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (typeArguments != null)
            {
                foreach (XamlType type in typeArguments)
                {
                    if (type == null)
                    {
                        throw new ArgumentException(System.Xaml.SR.Get("CollectionCannotContainNulls", new object[] { "typeArguments" }));
                    }
                    if (type.UnderlyingType == null)
                    {
                        return(null);
                    }
                }
            }
            XamlType xamlType = null;

            if ((typeArguments == null) || (typeArguments.Length == 0))
            {
                xamlType = XamlLanguage.LookupXamlType(xamlNamespace, name);
                if (xamlType != null)
                {
                    if (this.FullyQualifyAssemblyNamesInClrNamespaces)
                    {
                        xamlType = this.GetXamlType(xamlType.UnderlyingType);
                    }
                    return(xamlType);
                }
            }
            XamlNamespace namespace2     = this.GetXamlNamespace(xamlNamespace);
            int           revisionNumber = namespace2.RevisionNumber;

            xamlType = namespace2.GetXamlType(name, typeArguments);
            if ((xamlType == null) && !namespace2.IsClrNamespace)
            {
                this.UpdateXmlNsInfo();
                if (namespace2.RevisionNumber > revisionNumber)
                {
                    xamlType = namespace2.GetXamlType(name, typeArguments);
                }
            }
            return(xamlType);
        }
示例#2
0
 public virtual XamlDirective GetXamlDirective(string xamlNamespace, string name)
 {
     if (xamlNamespace == null)
     {
         throw new ArgumentNullException("xamlNamespace");
     }
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (XamlLanguage.XamlNamespaces.Contains(xamlNamespace))
     {
         return(XamlLanguage.LookupXamlDirective(name));
     }
     if (XamlLanguage.XmlNamespaces.Contains(xamlNamespace))
     {
         return(XamlLanguage.LookupXmlDirective(name));
     }
     return(null);
 }
示例#3
0
 public virtual XamlType GetXamlType(Type type)
 {
     return(this.GetXamlType(type, XamlLanguage.TypeAlias(type)));
 }
示例#4
0
 private static bool IsDirective(XName name)
 {
     return(XamlLanguage.NamespaceName == name.NamespaceName &&
            XamlLanguage.IsDirective(new XamlName(name.LocalName, name.NamespaceName)));
 }
示例#5
0
 private static bool IsDirective(XmlElement element)
 {
     return(XamlLanguage.NamespaceName == element.NamespaceURI &&
            XamlLanguage.IsDirective(new XamlName(element.LocalName, element.NamespaceURI)));
 }
示例#6
0
 private static bool IsDirective(XmlAttribute attribute)
 {
     return(XamlLanguage.NamespaceName == attribute.NamespaceURI &&
            XamlLanguage.IsDirective(new XamlName(attribute.LocalName, attribute.NamespaceURI)));
 }