Example #1
0
        public EXamlAddEvent(EXamlContext context, EXamlCreateObject instance, EXamlCreateObject element, string eventName, MethodDefinition value)
            : base(context)
        {
            TypeReference typeref;
            var           eventDef = instance.Type.GetEvent(fi => fi.Name == eventName, out typeref);

            if (null != eventDef)
            {
                Instance      = instance;
                Element       = element;
                Value         = value;
                DeclaringType = typeref;

                this.eventDef = eventDef;

                Instance.AddEvent(DeclaringType, eventDef);

                eXamlContext.eXamlOperations.Add(this);
                eXamlContext.eXamlAddEventList.Add(this);
            }
            else
            {
                throw new Exception("Property is not element");
            }
        }
Example #2
0
        public EXamlAddToCollectionInstance(EXamlContext context, EXamlCreateObject instance, object value)
            : base(context)
        {
            this.instance = instance;
            this.value    = value;

            eXamlContext.eXamlOperations.Add(this);
        }
Example #3
0
        internal EXamlGetObjectByProperty(EXamlContext context, EXamlCreateObject instance, string propertyName)
            : base(context)
        {
            this.instance     = instance;
            this.propertyName = propertyName;
            eXamlContext.objectsAccordingToProperty.Add(this);

            eXamlContext.eXamlOperations.Add(this);
        }
        public EXamlAddToResourceDictionary(EXamlContext context, EXamlCreateObject @object, string key, object value)
            : base(context)
        {
            instance   = @object;
            this.key   = key;
            this.value = value;
            eXamlContext.eXamlOperations.Add(this);

            eXamlContext.resourceDictionary.Add(key, value);
        }
Example #5
0
        public EXamlSetDynamicResource(EXamlContext context, EXamlCreateObject @object, MemberReference bindalbeProperty, string key)
            : base(context)
        {
            this.@object          = @object;
            this.bindableProperty = bindalbeProperty;
            this.key = key;
            eXamlContext.eXamlOperations.Add(this);

            @object.AddBindableProperty(bindableProperty);
        }
Example #6
0
        public EXamlAddObject(EXamlContext context, EXamlCreateObject parent, object child, MethodDefinition addMethod)
            : base(context)
        {
            Parent = parent;
            Child  = child;
            Method = addMethod;

            eXamlContext.eXamlOperations.Add(this);
            eXamlContext.eXamlAddObjectList.Add(this);
        }
Example #7
0
        public EXamlSetBindalbeProperty(EXamlContext context, EXamlCreateObject @object, MemberReference bindableProperty, object value)
            : base(context)
        {
            Instance         = @object;
            BindableProperty = bindableProperty;
            Value            = value;

            Instance.AddBindableProperty(bindableProperty);

            eXamlContext.eXamlOperations.Add(this);
        }
Example #8
0
        public EXamlSetBinding(EXamlContext context, EXamlCreateObject @object, MemberReference bindableProperty, object binding)
            : base(context)
        {
            Instance         = @object;
            BindableProperty = bindableProperty;
            Value            = binding as EXamlCreateObject;
            if (null == Value)
            {
                throw new Exception($"Can't set binding {binding.ToString()} to {bindableProperty.FullName}");
            }
            eXamlContext.eXamlOperations.Add(this);

            Instance.AddBindableProperty(bindableProperty);
        }
Example #9
0
        public EXamlSetProperty(EXamlContext context, EXamlCreateObject instance, string propertyName, object value)
            : base(context)
        {
            var property = instance.Type.GetProperty(fi => fi.Name == propertyName, out declareTypeRef);

            if (null != property)
            {
                this.instance = instance;
                this.property = property;
                this.value    = value;

                if (null != this.instance.Instance)
                {
                    var propertyInfo = this.instance.Instance.GetType().GetProperty(property.Name);

                    if (value is EXamlCreateObject eXamlCreateObject && null != eXamlCreateObject.Instance)
                    {
                        if (this.instance.Instance is BindingExtension bindingExtension
                            &&
                            eXamlCreateObject.Type.FullName == typeof(BindingMode).FullName)
                        {
                            bindingExtension.ModeInEXaml = eXamlCreateObject;
                        }
                        else if (eXamlCreateObject.Type.ResolveCached().IsEnum)
                        {
                            if (eXamlCreateObject.Type.FullName == typeof(BindingMode).FullName)
                            {
                                var realValue = Enum.Parse(typeof(BindingMode), eXamlCreateObject.Instance as string);
                                propertyInfo.SetMethod.Invoke(this.instance.Instance, new object[] { realValue });
                            }
                        }
                        else
                        {
                            if (instance.GetType().FullName == typeof(Xaml.Build.Tasks.ArrayExtension).FullName
                                &&
                                "Type" == propertyName)
                            {
                                eXamlCreateObject.IsValid = false;
                            }

                            propertyInfo.SetMethod.Invoke(this.instance.Instance, new object[] { eXamlCreateObject.Instance });
                        }
                    }
                    else
                    {
                        propertyInfo.SetMethod.Invoke(this.instance.Instance, new object[] { value });
                    }
                }
        internal EXamlValueConverterFromString(EXamlContext context, TypeDefinition converterType, string value)
        {
            this.context = context;

            ConverterType = converterType;
            Value         = value;

            if (!context.typeToInstance.ContainsKey(converterType))
            {
                converterInstance = new EXamlCreateObject(context, null, converterType);
                context.typeToInstance.Add(converterType, converterInstance);
            }
            else
            {
                converterInstance = context.typeToInstance[converterType];
            }
        }
 public EXamlAddToResourceDictionary(EXamlContext context, EXamlCreateObject @object, EXamlCreateObject value)
     : base(context)
 {
     eXamlContext.eXamlOperations.Add(this);
 }