// Token: 0x06002482 RID: 9346 RVA: 0x000B0F42 File Offset: 0x000AF142
 internal override IEnumerable <MarkupProperty> GetProperties(bool mapToConstructorArgs)
 {
     if (this._factory.Type == null)
     {
         if (this._factory.Text != null)
         {
             yield return(new FrameworkElementFactoryStringContent(this._factory, this));
         }
     }
     else
     {
         FrugalStructList <PropertyValue> propertyValues = this._factory.PropertyValues;
         int num;
         for (int i = 0; i < propertyValues.Count; i = num + 1)
         {
             if (propertyValues[i].Property != XmlAttributeProperties.XmlnsDictionaryProperty)
             {
                 yield return(new FrameworkElementFactoryProperty(propertyValues[i], this));
             }
             num = i;
         }
         ElementMarkupObject elementMarkupObject = new ElementMarkupObject(this._factory, this.Manager);
         foreach (MarkupProperty markupProperty in elementMarkupObject.Properties)
         {
             if (markupProperty.Name == "Triggers" && markupProperty.Name == "Storyboard")
             {
                 yield return(markupProperty);
             }
         }
         IEnumerator <MarkupProperty> enumerator = null;
         if (this._factory.FirstChild != null)
         {
             if (this._factory.FirstChild.Type == null)
             {
                 yield return(new FrameworkElementFactoryStringContent(this._factory.FirstChild, this));
             }
             else
             {
                 yield return(new FrameworkElementFactoryContent(this._factory, this));
             }
         }
         propertyValues = default(FrugalStructList <PropertyValue>);
     }
     yield break;
     yield break;
 }
示例#2
0
        private bool HasNoSerializableProperties(object value)
        {
            if (value is FrameworkElementFactory)
            {
                return(true);
            }
            ElementMarkupObject item = new ElementMarkupObject(value, Manager);

            foreach (MarkupProperty property in item.Properties)
            {
                if (!property.IsContent)
                {
                    return(false);
                }
            }
            return(true);
        }
        internal override IEnumerable <MarkupProperty> GetProperties(bool mapToConstructorArgs)
        {
            // This #if is included to make this implementation easier to test outside the assembly.
            // This is the only place in ElementItem and FrameworkElementItem where internal members
            // are accessed that cannot be easily copied by the host.
            if (_factory.Type == null)
            {
                if (_factory.Text != null)
                {
                    yield return(new FrameworkElementFactoryStringContent(_factory, this));
                }
            }
            else
            {
                FrugalStructList <PropertyValue> propertyValues = _factory.PropertyValues;
                for (int i = 0; i < propertyValues.Count; i++)
                {
                    if (propertyValues[i].Property != XmlAttributeProperties.XmlnsDictionaryProperty)
                    {
                        yield return(new FrameworkElementFactoryProperty(propertyValues[i], this));
                    }
                }
                ElementMarkupObject item = new ElementMarkupObject(_factory, Manager);
                foreach (MarkupProperty property in item.Properties)
                {
                    if (property.Name == "Triggers" && property.Name == "Storyboard")
                    {
                        yield return(property);
                    }
                }

                if (_factory.FirstChild != null)
                {
                    if (_factory.FirstChild.Type == null)
                    {
                        yield return(new FrameworkElementFactoryStringContent(_factory.FirstChild, this));
                    }
                    else
                    {
                        yield return(new FrameworkElementFactoryContent(_factory, this));
                    }
                }
            }
        }
        // Token: 0x0600240C RID: 9228 RVA: 0x000AFC1A File Offset: 0x000ADE1A
        internal override IEnumerable <MarkupProperty> GetProperties(bool mapToConstructorArgs)
        {
            ValueSerializer serializerFor = ValueSerializer.GetSerializerFor(this.ObjectType, this.Context);

            if (serializerFor != null && serializerFor.CanConvertToString(this._instance, this.Context))
            {
                yield return(new ElementStringValueProperty(this));

                if (this._key != null)
                {
                    yield return(this._key);
                }
            }
            else
            {
                Dictionary <string, string> constructorArguments = null;
                IEnumerator enumerator;
                if (mapToConstructorArgs && this._instance is MarkupExtension)
                {
                    ParameterInfo[] parameters;
                    ICollection     collection;
                    if (this.TryGetConstructorInfoArguments(this._instance, out parameters, out collection))
                    {
                        int i = 0;
                        foreach (object obj in collection)
                        {
                            if (constructorArguments == null)
                            {
                                constructorArguments = new Dictionary <string, string>();
                            }
                            constructorArguments.Add(parameters[i].Name, parameters[i].Name);
                            object          value = obj;
                            ParameterInfo[] array = parameters;
                            int             num   = i;
                            i = num + 1;
                            yield return(new ElementConstructorArgument(value, array[num].ParameterType, this));
                        }
                        enumerator = null;
                    }
                    parameters = null;
                }
                foreach (object obj2 in TypeDescriptor.GetProperties(this._instance))
                {
                    PropertyDescriptor propertyDescriptor = (PropertyDescriptor)obj2;
                    DesignerSerializationVisibility serializationVisibility = propertyDescriptor.SerializationVisibility;
                    if (serializationVisibility != DesignerSerializationVisibility.Hidden && (!propertyDescriptor.IsReadOnly || serializationVisibility == DesignerSerializationVisibility.Content) && ElementMarkupObject.ShouldSerialize(propertyDescriptor, this._instance, this._manager))
                    {
                        if (serializationVisibility == DesignerSerializationVisibility.Content)
                        {
                            object value2 = propertyDescriptor.GetValue(this._instance);
                            if (value2 == null)
                            {
                                continue;
                            }
                            ICollection collection2 = value2 as ICollection;
                            if (collection2 != null && collection2.Count < 1)
                            {
                                continue;
                            }
                            IEnumerable enumerable = value2 as IEnumerable;
                            if (enumerable != null && !enumerable.GetEnumerator().MoveNext())
                            {
                                continue;
                            }
                        }
                        if (constructorArguments != null)
                        {
                            ConstructorArgumentAttribute constructorArgumentAttribute = propertyDescriptor.Attributes[typeof(ConstructorArgumentAttribute)] as ConstructorArgumentAttribute;
                            if (constructorArgumentAttribute != null && constructorArguments.ContainsKey(constructorArgumentAttribute.ArgumentName))
                            {
                                continue;
                            }
                        }
                        yield return(new ElementProperty(this, propertyDescriptor));
                    }
                }
                enumerator = null;
                IDictionary dictionary = this._instance as IDictionary;
                if (dictionary != null)
                {
                    yield return(new ElementDictionaryItemsPseudoProperty(dictionary, typeof(IDictionary), this));
                }
                else
                {
                    IEnumerable enumerable2 = this._instance as IEnumerable;
                    if (enumerable2 != null && enumerable2.GetEnumerator().MoveNext())
                    {
                        yield return(new ElementItemsPseudoProperty(enumerable2, typeof(IEnumerable), this));
                    }
                }
                if (this._key != null)
                {
                    yield return(this._key);
                }
                constructorArguments = null;
            }
            yield break;
            yield break;
        }
        // Token: 0x06002412 RID: 9234 RVA: 0x000AFC68 File Offset: 0x000ADE68
        private static bool ShouldSerialize(PropertyDescriptor pd, object instance, XamlDesignerSerializationManager manager)
        {
            object obj = instance;
            DependencyPropertyDescriptor dependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(pd);
            MethodInfo methodInfo;

            if (dependencyPropertyDescriptor != null && dependencyPropertyDescriptor.IsAttached)
            {
                Type   ownerType    = dependencyPropertyDescriptor.DependencyProperty.OwnerType;
                string name         = dependencyPropertyDescriptor.DependencyProperty.Name;
                string propertyName = name + "!";
                if (!ElementMarkupObject.TryGetShouldSerializeMethod(new ElementMarkupObject.ShouldSerializeKey(ownerType, propertyName), out methodInfo))
                {
                    string name2 = "ShouldSerialize" + name;
                    methodInfo = ownerType.GetMethod(name2, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsObject, null);
                    if (methodInfo == null)
                    {
                        methodInfo = ownerType.GetMethod(name2, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsManager, null);
                    }
                    if (methodInfo == null)
                    {
                        methodInfo = ownerType.GetMethod(name2, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsMode, null);
                    }
                    if (methodInfo == null)
                    {
                        methodInfo = ownerType.GetMethod(name2, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsObjectManager, null);
                    }
                    if (methodInfo != null && methodInfo.ReturnType != typeof(bool))
                    {
                        methodInfo = null;
                    }
                    ElementMarkupObject.CacheShouldSerializeMethod(new ElementMarkupObject.ShouldSerializeKey(ownerType, propertyName), methodInfo);
                }
                obj = null;
            }
            else if (!ElementMarkupObject.TryGetShouldSerializeMethod(new ElementMarkupObject.ShouldSerializeKey(instance.GetType(), pd.Name), out methodInfo))
            {
                Type   type  = instance.GetType();
                string name3 = "ShouldSerialize" + pd.Name;
                methodInfo = type.GetMethod(name3, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsObject, null);
                if (methodInfo == null)
                {
                    methodInfo = type.GetMethod(name3, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsManager, null);
                }
                if (methodInfo == null)
                {
                    methodInfo = type.GetMethod(name3, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsMode, null);
                }
                if (methodInfo == null)
                {
                    methodInfo = type.GetMethod(name3, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ElementMarkupObject._shouldSerializeArgsObjectManager, null);
                }
                if (methodInfo != null && methodInfo.ReturnType != typeof(bool))
                {
                    methodInfo = null;
                }
                ElementMarkupObject.CacheShouldSerializeMethod(new ElementMarkupObject.ShouldSerializeKey(type, pd.Name), methodInfo);
            }
            if (methodInfo != null)
            {
                ParameterInfo[] parameters = methodInfo.GetParameters();
                if (parameters != null)
                {
                    object[] parameters2;
                    if (parameters.Length == 1)
                    {
                        if (parameters[0].ParameterType == typeof(DependencyObject))
                        {
                            parameters2 = new object[]
                            {
                                instance as DependencyObject
                            };
                        }
                        else if (parameters[0].ParameterType == typeof(XamlWriterMode))
                        {
                            parameters2 = new object[]
                            {
                                manager.XamlWriterMode
                            };
                        }
                        else
                        {
                            parameters2 = new object[]
                            {
                                manager
                            };
                        }
                    }
                    else
                    {
                        parameters2 = new object[]
                        {
                            instance as DependencyObject,
                            manager
                        };
                    }
                    return((bool)methodInfo.Invoke(obj, parameters2));
                }
            }
            return(pd.ShouldSerializeValue(instance));
        }
示例#6
0
 internal ElementKey(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
示例#7
0
 internal ElementItemsPseudoProperty(IEnumerable value, Type type, ElementMarkupObject obj) : base(value, type, obj)
 { 
     _value = value;
 } 
示例#8
0
 protected ElementObjectPropertyBase(ElementMarkupObject obj) : base(obj.Manager)
 {
     Debug.Assert(obj != null);
     _object = obj;
 }
示例#9
0
 internal ElementStringValueProperty(ElementMarkupObject obj) 
 {
     _object = obj; 
 }
示例#10
0
 internal ElementKey(object value, Type type, ElementMarkupObject obj) : base(value, type, obj)
 {
 }
示例#11
0
 protected ElementObjectPropertyBase(ElementMarkupObject obj): base(obj.Manager) 
 {
     Debug.Assert(obj != null);
     _object = obj;
 } 
示例#12
0
 internal ElementProperty(ElementMarkupObject obj, PropertyDescriptor descriptor) : base(obj) 
 { 
     Debug.Assert(descriptor != null);
     _descriptor = descriptor; 
 }
示例#13
0
 private bool HasNoSerializableProperties(object value)
 {
     if (value is FrameworkElementFactory) 
         return true;
     ElementMarkupObject item = new ElementMarkupObject(value, Manager); 
     foreach (MarkupProperty property in item.Properties) 
     {
         if (!property.IsContent) 
         {
             return false;
         }
     } 
     return true;
 } 
示例#14
0
 public ElementObjectContext(ElementMarkupObject obj, IValueSerializerContext baseContext): base(baseContext)
 { 
     _object = obj; 
 }
示例#15
0
 internal ElementDictionaryItemsPseudoProperty(IDictionary value, Type type, ElementMarkupObject obj) : base(value, type, obj) 
 { 
     _value = value;
 } 
示例#16
0
 internal ElementStringValueProperty(ElementMarkupObject obj)
 {
     _object = obj;
 }
示例#17
0
 internal ElementItemsPseudoProperty(IEnumerable value, Type type, ElementMarkupObject obj) : base(value, type, obj)
 {
     _value = value;
 }
示例#18
0
 internal ElementPseudoPropertyBase(object value, Type type, ElementMarkupObject obj) : base(obj)
 {
     _value = value;
     _type  = type;
 }
示例#19
0
 public ElementObjectContext(ElementMarkupObject obj, IValueSerializerContext baseContext) : base(baseContext)
 {
     _object = obj;
 }
示例#20
0
 internal ElementConstructorArgument(object value, Type type, ElementMarkupObject obj) : base(value, type, obj)
 {
 }
示例#21
0
 internal ElementConstructorArgument(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
示例#22
0
 internal ElementDictionaryItemsPseudoProperty(IDictionary value, Type type, ElementMarkupObject obj) : base(value, type, obj)
 {
     _value = value;
 }
        internal override IEnumerable<MarkupProperty> GetProperties(bool mapToConstructorArgs)
        {
            // This #if is included to make this implementation easier to test outside the assembly.
            // This is the only place in ElementItem and FrameworkElementItem where internal members
            // are accessed that cannot be easily copied by the host.
            if (_factory.Type == null)
            {
                if (_factory.Text != null)
                {
                    yield return new FrameworkElementFactoryStringContent(_factory, this);
                }
            }
            else
            {
                FrugalStructList<PropertyValue> propertyValues = _factory.PropertyValues;
                for (int i = 0; i < propertyValues.Count; i++)
                {
                    if (propertyValues[i].Property != XmlAttributeProperties.XmlnsDictionaryProperty)
                    {
                        yield return new FrameworkElementFactoryProperty(propertyValues[i], this);
                    }
                }
                ElementMarkupObject item = new ElementMarkupObject(_factory, Manager);
                foreach (MarkupProperty property in item.Properties)
                {
                    if (property.Name == "Triggers" && property.Name == "Storyboard")
                    {
                        yield return property;
                    }
                }

                if (_factory.FirstChild != null)
                {
                    if (_factory.FirstChild.Type == null)
                    {
                        yield return new FrameworkElementFactoryStringContent(_factory.FirstChild, this);
                    }
                    else
                    {
                        yield return new FrameworkElementFactoryContent(_factory, this);
                    }
                }
            }
        }
 // Token: 0x06002427 RID: 9255 RVA: 0x000B0469 File Offset: 0x000AE669
 protected ElementObjectPropertyBase(ElementMarkupObject obj) : base(obj.Manager)
 {
     this._object = obj;
 }
 // Token: 0x0600242A RID: 9258 RVA: 0x000B0498 File Offset: 0x000AE698
 internal ElementProperty(ElementMarkupObject obj, PropertyDescriptor descriptor) : base(obj)
 {
     this._descriptor = descriptor;
 }
示例#26
0
 internal ElementProperty(ElementMarkupObject obj, PropertyDescriptor descriptor) : base(obj)
 {
     Debug.Assert(descriptor != null);
     _descriptor = descriptor;
 }
示例#27
0
 internal ElementPseudoPropertyBase(object value, Type type, ElementMarkupObject obj) : base(obj) 
 {
     _value = value; 
     _type = type; 
 }