// Token: 0x060015E4 RID: 5604 RVA: 0x0006AECC File Offset: 0x000690CC
        private static XamlMember FindKnownMember(WpfXamlType wpfXamlType, string name, bool isAttachable)
        {
            XamlMember xamlMember = null;

            if (!isAttachable || wpfXamlType.IsBamlScenario)
            {
                if (wpfXamlType._members != null && wpfXamlType.Members.TryGetValue(name, out xamlMember))
                {
                    return(xamlMember);
                }
            }
            else if (wpfXamlType._attachableMembers != null && wpfXamlType.AttachableMembers.TryGetValue(name, out xamlMember))
            {
                return(xamlMember);
            }
            WpfKnownType wpfKnownType = wpfXamlType as WpfKnownType;

            if (wpfKnownType != null)
            {
                if (!isAttachable || wpfXamlType.IsBamlScenario)
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownMember(wpfXamlType.Name, name);
                }
                if (isAttachable || (xamlMember == null && wpfXamlType.IsBamlScenario))
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownAttachableMember(wpfXamlType.Name, name);
                }
                if (xamlMember != null)
                {
                    return(wpfKnownType.CacheAndReturnXamlMember(xamlMember));
                }
            }
            return(null);
        }
        public override XamlType GetXamlType(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            XamlType xType;

            lock (_syncObject)
            {
                if (!_masterTypeTable.TryGetValue(type, out xType))
                {
                    RequireRuntimeType(type);
                    xType = CreateKnownBamlType(type.Name, false, _useV3Rules);
                    if (xType == null || xType.UnderlyingType != type)
                    {
                        xType = new WpfXamlType(type, this, false /* isBamlType */, _useV3Rules);
                    }
                    _masterTypeTable.Add(type, xType);
                }
            }

            return(xType);
        }
Ejemplo n.º 3
0
        public override XamlType GetXamlType(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            XamlType xType;
             
            lock (_syncObject)
            {
                if (!_masterTypeTable.TryGetValue(type, out xType))
                {
                    RequireRuntimeType(type);
                    xType = CreateKnownBamlType(type.Name, false, _useV3Rules);
                    if (xType == null || xType.UnderlyingType != type)
                    {
                        xType = new WpfXamlType(type, this, false /* isBamlType */, _useV3Rules);
                    }
                    _masterTypeTable.Add(type, xType);
                }
            }

            return xType;
        }
        // Token: 0x060015DC RID: 5596 RVA: 0x0006AB34 File Offset: 0x00068D34
        private XamlMember FindKnownMember(string name, bool isAttachable)
        {
            XamlType xamlType = this;

            if (this is WpfKnownType)
            {
                XamlMember xamlMember;
                for (;;)
                {
                    WpfXamlType wpfXamlType = xamlType as WpfXamlType;
                    xamlMember = WpfXamlType.FindKnownMember(wpfXamlType, name, isAttachable);
                    if (xamlMember != null)
                    {
                        break;
                    }
                    xamlType = xamlType.BaseType;
                    if (!(xamlType != null))
                    {
                        goto IL_35;
                    }
                }
                return(xamlMember);
            }
IL_35:
            return(null);
        }
        // Token: 0x060015DD RID: 5597 RVA: 0x0006AB78 File Offset: 0x00068D78
        private XamlMember FindRoutedEventBackedProperty(string name, bool isAttachable, bool skipReadOnlyCheck)
        {
            RoutedEvent routedEventFromName = EventManager.GetRoutedEventFromName(name, base.UnderlyingType);
            XamlMember  xamlMember          = null;

            if (routedEventFromName == null)
            {
                return(xamlMember);
            }
            WpfXamlType wpfXamlType;

            if (this.IsBamlScenario)
            {
                wpfXamlType = (System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(routedEventFromName.OwnerType) as WpfXamlType);
            }
            else
            {
                wpfXamlType = (System.Windows.Markup.XamlReader.GetWpfSchemaContext().GetXamlType(routedEventFromName.OwnerType) as WpfXamlType);
            }
            if (wpfXamlType != null)
            {
                xamlMember = WpfXamlType.FindKnownMember(wpfXamlType, name, isAttachable);
            }
            if (this.IsBamlScenario)
            {
                xamlMember = new WpfXamlMember(routedEventFromName, isAttachable);
            }
            else if (isAttachable)
            {
                xamlMember = this.GetAttachedRoutedEvent(name, routedEventFromName);
                if (xamlMember == null)
                {
                    xamlMember = this.GetRoutedEvent(name, routedEventFromName, skipReadOnlyCheck);
                }
                if (xamlMember == null)
                {
                    xamlMember = new WpfXamlMember(routedEventFromName, true);
                }
            }
            else
            {
                xamlMember = this.GetRoutedEvent(name, routedEventFromName, skipReadOnlyCheck);
                if (xamlMember == null)
                {
                    xamlMember = this.GetAttachedRoutedEvent(name, routedEventFromName);
                }
                if (xamlMember == null)
                {
                    xamlMember = new WpfXamlMember(routedEventFromName, false);
                }
            }
            if (this.Members.TryAdd(name, xamlMember))
            {
                return(xamlMember);
            }
            return(this.Members[name]);
        }
        // Token: 0x060015DE RID: 5598 RVA: 0x0006AC74 File Offset: 0x00068E74
        private XamlMember FindDependencyPropertyBackedProperty(string name, bool isAttachable, bool skipReadOnlyCheck)
        {
            XamlMember         xamlMember = null;
            DependencyProperty dependencyProperty;

            if ((dependencyProperty = DependencyProperty.FromName(name, base.UnderlyingType)) != null)
            {
                WpfXamlType wpfXamlType;
                if (this.IsBamlScenario)
                {
                    wpfXamlType = (System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(dependencyProperty.OwnerType) as WpfXamlType);
                }
                else
                {
                    wpfXamlType = (System.Windows.Markup.XamlReader.GetWpfSchemaContext().GetXamlType(dependencyProperty.OwnerType) as WpfXamlType);
                }
                if (wpfXamlType != null)
                {
                    xamlMember = WpfXamlType.FindKnownMember(wpfXamlType, name, isAttachable);
                }
                if (xamlMember == null)
                {
                    if (this.IsBamlScenario)
                    {
                        xamlMember = new WpfXamlMember(dependencyProperty, isAttachable);
                    }
                    else if (isAttachable)
                    {
                        xamlMember = this.GetAttachedDependencyProperty(name, dependencyProperty);
                        if (xamlMember == null)
                        {
                            return(null);
                        }
                    }
                    else
                    {
                        xamlMember = this.GetRegularDependencyProperty(name, dependencyProperty, skipReadOnlyCheck);
                        if (xamlMember == null)
                        {
                            xamlMember = this.GetAttachedDependencyProperty(name, dependencyProperty);
                        }
                        if (xamlMember == null)
                        {
                            xamlMember = new WpfXamlMember(dependencyProperty, false);
                        }
                    }
                    return(this.CacheAndReturnXamlMember(xamlMember));
                }
            }
            return(xamlMember);
        }
Ejemplo n.º 7
0
        // Assumes that GetKnownXamlType was called first
        private XamlType GetUnknownXamlType(Type type)
        {
            XamlType xamlType;

            lock (_syncObject)
            {
                if (!_masterTypeTable.TryGetValue(type, out xamlType))
                {
                    WpfSharedXamlSchemaContext.RequireRuntimeType(type);
                    xamlType = new WpfXamlType(type, this, true, true);
                    _masterTypeTable.Add(type, xamlType);
                }
            }
            return(xamlType);
        }
Ejemplo n.º 8
0
        // First try looking at the cache
        // Then look to see if we have a known property on the type
        private static XamlMember FindKnownMember(WpfXamlType wpfXamlType, string name, bool isAttachable)
        {
            XamlMember xamlMember = null;

            // Look in the cache first
            if (!isAttachable || wpfXamlType.IsBamlScenario)
            {
                if (wpfXamlType._members != null && wpfXamlType.Members.TryGetValue(name, out xamlMember))
                {
                    return(xamlMember);
                }
            }
            else
            {
                if (wpfXamlType._attachableMembers != null && wpfXamlType.AttachableMembers.TryGetValue(name, out xamlMember))
                {
                    return(xamlMember);
                }
            }

            WpfKnownType knownType = wpfXamlType as WpfKnownType;

            // Only look for known properties on a known type
            if (knownType != null)
            {
                // if it is a Baml Senario BAML doesn't really care if it was attachable or not
                // so look for the property in AttachableMembers also if it wasn't found in Members.
                if (!isAttachable || wpfXamlType.IsBamlScenario)
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownMember(wpfXamlType.Name, name);
                }
                if (isAttachable || (xamlMember == null && wpfXamlType.IsBamlScenario))
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownAttachableMember(wpfXamlType.Name, name);
                }

                if (xamlMember != null)
                {
                    return(knownType.CacheAndReturnXamlMember(xamlMember));
                }
            }
            return(null);
        }
Ejemplo n.º 9
0
        // This will first check the cache on the type
        // Then will look for a knownMember if the type is a WpfKnownType
        // Then we look a DependencyProperty for the member
        //      If we do find one, double check to see if there is a known member that matches the DP
        //          This only happens on non-known types that derive from known types
        // Otherwise, return null
        private XamlMember FindKnownMember(string name, bool isAttachable)
        {
            XamlType type = this;

            // Only support looking up KnownMembers on KnownTypes (otherwise we could miss a new/override member)
            if (this is WpfKnownType)
            {
                do
                {
                    WpfXamlType wpfXamlType = type as WpfXamlType;
                    XamlMember  xamlMember  = FindKnownMember(wpfXamlType, name, isAttachable);
                    if (xamlMember != null)
                    {
                        return(xamlMember);
                    }

                    type = type.BaseType;
                }while (type != null);
            }
            return(null);
        }
        // Token: 0x060015D8 RID: 5592 RVA: 0x0006AA14 File Offset: 0x00068C14
        private XamlMember FindMember(string name, bool isAttached, bool skipReadOnlyCheck)
        {
            XamlMember xamlMember = this.FindKnownMember(name, isAttached);

            if (xamlMember != null)
            {
                return(xamlMember);
            }
            xamlMember = this.FindDependencyPropertyBackedProperty(name, isAttached, skipReadOnlyCheck);
            if (xamlMember != null)
            {
                return(xamlMember);
            }
            xamlMember = this.FindRoutedEventBackedProperty(name, isAttached, skipReadOnlyCheck);
            if (xamlMember != null)
            {
                return(xamlMember);
            }
            if (isAttached)
            {
                xamlMember = base.LookupAttachableMember(name);
            }
            else
            {
                xamlMember = base.LookupMember(name, skipReadOnlyCheck);
            }
            WpfKnownType wpfXamlType;

            if (xamlMember != null && (wpfXamlType = (xamlMember.DeclaringType as WpfKnownType)) != null)
            {
                XamlMember xamlMember2 = WpfXamlType.FindKnownMember(wpfXamlType, name, isAttached);
                if (xamlMember2 != null)
                {
                    return(xamlMember2);
                }
            }
            return(xamlMember);
        }
Ejemplo n.º 11
0
        // Token: 0x060015AB RID: 5547 RVA: 0x0006A34C File Offset: 0x0006854C
        public override XamlType GetXamlType(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            object   syncObject = this._syncObject;
            XamlType xamlType;

            lock (syncObject)
            {
                if (!this._masterTypeTable.TryGetValue(type, out xamlType))
                {
                    WpfSharedXamlSchemaContext.RequireRuntimeType(type);
                    xamlType = base.CreateKnownBamlType(type.Name, false, this._useV3Rules);
                    if (xamlType == null || xamlType.UnderlyingType != type)
                    {
                        xamlType = new WpfXamlType(type, this, false, this._useV3Rules);
                    }
                    this._masterTypeTable.Add(type, xamlType);
                }
            }
            return(xamlType);
        }
Ejemplo n.º 12
0
        private XamlMember FindDependencyPropertyBackedProperty(string name, bool isAttachable, bool skipReadOnlyCheck)
        {
            XamlMember xamlMember = null;

            // If it's a dependency property, return a wrapping XamlMember
            DependencyProperty property;

            if ((property = DependencyProperty.FromName(name, this.UnderlyingType)) != null)
            {
                // Try looking for a known member first instead of creating a new WpfXamlMember
                WpfXamlType wpfXamlType = null;
                if (IsBamlScenario)
                {
                    wpfXamlType = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(property.OwnerType) as WpfXamlType;
                }
                else
                {
                    wpfXamlType = System.Windows.Markup.XamlReader.GetWpfSchemaContext().GetXamlType(property.OwnerType) as WpfXamlType;
                }

                if (wpfXamlType != null)
                {
                    xamlMember = FindKnownMember(wpfXamlType, name, isAttachable);
                }

                if (xamlMember == null)
                {
                    if (IsBamlScenario)
                    {
                        // In Baml Scenarios, we don't want to lookup the MemberInfo since we always know the
                        // type converter and we don't allows DeferringLoader (since the MarkupCompiler doesn't support it)
                        xamlMember = new WpfXamlMember(property, isAttachable);
                    }
                    else
                    {
                        // Try to find the MemberInfo so we can use that directly.  There's no direct way to do this
                        // with XamlType so we'll just get the XamlMember and get the underlying member
                        if (isAttachable)
                        {
                            xamlMember = GetAttachedDependencyProperty(name, property);
                            if (xamlMember == null)
                            {
                                return(null);
                            }
                        }
                        else
                        {
                            xamlMember = GetRegularDependencyProperty(name, property, skipReadOnlyCheck);
                            if (xamlMember == null)
                            {
                                xamlMember = GetAttachedDependencyProperty(name, property);
                            }

                            if (xamlMember == null)
                            {
                                xamlMember = new WpfXamlMember(property, false);
                            }
                        }
                    }
                    return(CacheAndReturnXamlMember(xamlMember));
                }
            }
            return(xamlMember);
        }
Ejemplo n.º 13
0
        private XamlMember FindRoutedEventBackedProperty(string name, bool isAttachable, bool skipReadOnlyCheck)
        {
            RoutedEvent re = EventManager.GetRoutedEventFromName(
                name, UnderlyingType);
            XamlMember xamlMember = null;

            if (re != null)
            {
                // Try looking for a known member first instead of creating a new WpfXamlMember
                WpfXamlType wpfXamlType = null;
                if (IsBamlScenario)
                {
                    wpfXamlType = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(re.OwnerType) as WpfXamlType;
                }
                else
                {
                    wpfXamlType = System.Windows.Markup.XamlReader.GetWpfSchemaContext().GetXamlType(re.OwnerType) as WpfXamlType;
                }

                if (wpfXamlType != null)
                {
                    xamlMember = FindKnownMember(wpfXamlType, name, isAttachable);
                }

                if (IsBamlScenario)
                {
                    xamlMember = new WpfXamlMember(re, isAttachable);
                }
                else
                {
                    if (isAttachable)
                    {
                        xamlMember = GetAttachedRoutedEvent(name, re);
                        if (xamlMember == null)
                        {
                            xamlMember = GetRoutedEvent(name, re, skipReadOnlyCheck);
                        }

                        if (xamlMember == null)
                        {
                            xamlMember = new WpfXamlMember(re, true);
                        }
                    }
                    else
                    {
                        xamlMember = GetRoutedEvent(name, re, skipReadOnlyCheck);
                        if (xamlMember == null)
                        {
                            xamlMember = GetAttachedRoutedEvent(name, re);
                        }

                        if (xamlMember == null)
                        {
                            xamlMember = new WpfXamlMember(re, false);
                        }
                    }
                }
                if (Members.TryAdd(name, xamlMember))
                {
                    return(xamlMember);
                }
                else
                {
                    return(Members[name]);
                }
            }
            return(xamlMember);
        }
Ejemplo n.º 14
0
        // First try looking at the cache
        // Then look to see if we have a known property on the type
        private static XamlMember FindKnownMember(WpfXamlType wpfXamlType, string name, bool isAttachable)
        {
            XamlMember xamlMember = null;

            // Look in the cache first
            if (!isAttachable || wpfXamlType.IsBamlScenario)
            {
                if (wpfXamlType._members != null && wpfXamlType.Members.TryGetValue(name, out xamlMember))
                {
                    return xamlMember;
                }
            }
            else
            {
                if (wpfXamlType._attachableMembers != null && wpfXamlType.AttachableMembers.TryGetValue(name, out xamlMember))
                {
                    return xamlMember;
                }
            }

            WpfKnownType knownType = wpfXamlType as WpfKnownType;
            // Only look for known properties on a known type
            if (knownType != null)
            {
                // if it is a Baml Senario BAML doesn't really care if it was attachable or not
                // so look for the property in AttachableMembers also if it wasn't found in Members.
                if (!isAttachable || wpfXamlType.IsBamlScenario)
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownMember(wpfXamlType.Name, name);
                }
                if (isAttachable || (xamlMember == null && wpfXamlType.IsBamlScenario))
                {
                    xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.CreateKnownAttachableMember(wpfXamlType.Name, name);
                }

                if (xamlMember != null)
                {
                    return knownType.CacheAndReturnXamlMember(xamlMember);
                }
            }
            return null;
        }
        // Assumes that GetKnownXamlType was called first
        private XamlType GetUnknownXamlType(Type type) 
        {
            XamlType xamlType;

            lock (_syncObject) 
            {
                if (!_masterTypeTable.TryGetValue(type, out xamlType)) 
                { 
                    WpfSharedXamlSchemaContext.RequireRuntimeType(type);
                    xamlType = new WpfXamlType(type, this, true, true); 
                    _masterTypeTable.Add(type, xamlType);
                }
            }
            return xamlType; 
        }