public static global::System.Object getVisualStateProperty_50aaaf9819334ab9a5e132c1f664445d(global::System.Windows.DependencyObject finalTargetInstance)
        {
            global::System.Type finalTargetInstanceType             = finalTargetInstance.GetType();
            global::System.Type propertyDeclaringType               = finalTargetInstanceType.GetProperty("FontWeight").DeclaringType;
            global::System.Reflection.FieldInfo       propertyField = propertyDeclaringType.GetField("FontWeightProperty");
            global::System.Windows.DependencyProperty property      = (global::System.Windows.DependencyProperty)propertyField.GetValue(null);

            return(finalTargetInstance.GetVisualStateValue(property));
        }
        public static void setLocalVisualStateProperty_50aaaf9819334ab9a5e132c1f664445d(global::Windows.UI.Xaml.DependencyObject finalTargetInstance, object value)
        {
            global::System.Type finalTargetInstanceType = finalTargetInstance.GetType();
            global::System.Type propertyDeclaringType   = finalTargetInstanceType.GetProperty("FontWeight").DeclaringType;
            global::System.Reflection.FieldInfo        propertyField = propertyDeclaringType.GetField("FontWeightProperty");
            global::Windows.UI.Xaml.DependencyProperty property      = (global::Windows.UI.Xaml.DependencyProperty)propertyField.GetValue(null);

            (finalTargetInstance).SetLocalValue(property, value);
        }
示例#3
0
        private static PropertyInfo FindProperty(global::System.Type type, string name, BindingFlags flags)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            PropertyInfo property = type.GetProperty(name, flags);

            if (property != null)
            {
                return(property);
            }
            return(type.GetProperties(flags).FirstOrDefault <PropertyInfo>(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase)));
        }
示例#4
0
        public static object slowSetField(object obj, string field, object @value)
        {
            if ((obj == null))
            {
                throw new global::System.NullReferenceException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot access field \'", field), "\' of null."));
            }

            global::System.Type t = ((global::System.Type)((obj as global::System.Type)));
            global::System.Reflection.BindingFlags bf = default(global::System.Reflection.BindingFlags);
            if ((t == null))
            {
                t  = ((global::System.Type)(obj.GetType()));
                bf = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Instance)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public))))) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.FlattenHierarchy)))));
            }
            else
            {
                obj = null;
                bf  = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Static)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
            }

            global::System.Reflection.FieldInfo f = t.GetField(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
            if ((f != null))
            {
                if ((f.FieldType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, f.FieldType);
                }

                if ((((@value != null) && global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType())))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                f.SetValue(((object)(obj)), ((object)(@value)));
                return(@value);
            }
            else
            {
                global::System.Reflection.PropertyInfo prop = t.GetProperty(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
                if ((prop == null))
                {
                    if (t.IsCOMObject)
                    {
                        try {
                            return(t.InvokeMember(((string)(field)), ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.SetProperty)), default(global::System.Reflection.Binder), ((object)(obj)), ((object[])(new object[] { ((object)(@value)) }))));
                        }
                        catch (global::System.Exception e) {
                            global::haxe.lang.Exceptions.exception = e;
                        }
                    }

                    throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Field \'", field), "\' not found for writing from Class "), global::Std.@string(t)));
                }

                if ((prop.PropertyType as global::System.Reflection.MemberInfo).ToString().StartsWith("haxe.lang.Null"))
                {
                    @value = global::haxe.lang.Runtime.mkNullable(@value, prop.PropertyType);
                }

                if ((global::System.Object.ReferenceEquals(((global::System.Type)(typeof(global::System.Double))), ((object)(@value.GetType()))) && !(global::System.Object.ReferenceEquals(((object)(t)), ((object)(f.FieldType))))))
                {
                    @value = ((global::System.IConvertible)((@value as global::System.IConvertible))).ToType(((global::System.Type)(f.FieldType)), default(global::System.IFormatProvider));
                }

                prop.SetValue(((object)(obj)), ((object)(@value)), default(object[]));
                return(@value);
            }
        }
示例#5
0
        public static object slowGetField(object obj, string field, bool throwErrors)
        {
            if ((obj == null))
            {
                if (throwErrors)
                {
                    throw new global::System.NullReferenceException(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot access field \'", field), "\' of null."));
                }
                else
                {
                    return(null);
                }
            }

            global::System.Type t = ((global::System.Type)((obj as global::System.Type)));
            global::System.Reflection.BindingFlags bf = default(global::System.Reflection.BindingFlags);
            if ((t == null))
            {
                string s = ((string)((obj as string)));
                if (!(string.Equals(s, null)))
                {
                    return(global::haxe.lang.StringRefl.handleGetField(s, field, throwErrors));
                }

                t  = ((global::System.Type)(obj.GetType()));
                bf = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Instance)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public))))) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.FlattenHierarchy)))));
            }
            else
            {
                if (((t == ((global::System.Type)(typeof(string)))) && string.Equals(field, "fromCharCode")))
                {
                    return(new global::haxe.lang.Closure(typeof(global::haxe.lang.StringExt), field, 0));
                }

                obj = null;
                bf  = ((global::System.Reflection.BindingFlags)((((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Static)) | ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.Public)))));
            }

            global::System.Reflection.FieldInfo f = t.GetField(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
            if ((f != null))
            {
                return(global::haxe.lang.Runtime.unbox(f.GetValue(((object)(obj)))));
            }
            else
            {
                global::System.Reflection.PropertyInfo prop = t.GetProperty(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
                if ((prop == null))
                {
                    global::System.Reflection.MemberInfo[] m = t.GetMember(((string)(field)), ((global::System.Reflection.BindingFlags)(bf)));
                    if ((((m as global::System.Array).Length == 0) && ((string.Equals(field, "__get") || string.Equals(field, "__set")))))
                    {
                        m = t.GetMember(((string)(((string.Equals(field, "__get")) ? ("get_Item") : ("set_Item")))), ((global::System.Reflection.BindingFlags)(bf)));
                    }

                    if (((m as global::System.Array).Length > 0))
                    {
                        return(new global::haxe.lang.Closure((((obj != null)) ? (obj) : ((object)(t))), field, 0));
                    }
                    else
                    {
                        if (t.IsCOMObject)
                        {
                            try {
                                return(t.InvokeMember(((string)(field)), ((global::System.Reflection.BindingFlags)(global::System.Reflection.BindingFlags.GetProperty)), default(global::System.Reflection.Binder), ((object)(obj)), ((object[])(new object[0]))));
                            }
                            catch (global::System.Exception e) {
                                global::haxe.lang.Exceptions.exception = e;
                            }
                        }

                        if (throwErrors)
                        {
                            throw global::haxe.lang.HaxeException.wrap(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("Cannot access field \'", field), "\'."));
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }

                return(global::haxe.lang.Runtime.unbox(prop.GetValue(((object)(obj)), default(object[]))));
            }
        }