コード例 #1
0
 CommandMeta(TypeMeta owner, MethodInfo method, MemberMeta condition)
     : base(owner, method.Name, typeof(ICommand))
 {
     Method       = method;
     Condition    = condition;
     HasParameter = method.GetParameters().Any();
 }
コード例 #2
0
ファイル: CommandMeta.cs プロジェクト: Railgun-it/Assisticant
 CommandMeta(TypeMeta owner, MethodInfo method, MemberMeta condition)
     : base(owner, method.Name, typeof(ICommand))
 {
     Method = method;
     Condition = condition;
     HasParameter = method.GetParameters().Any();
 }
コード例 #3
0
 public ProxyTypeDescriptor(Type type)
 {
     Meta = TypeMeta.Get(type);
     ProxyType = typeof(PlatformProxy<>).MakeGenericType(type);
     _properties = Meta.Members.Select(m => new ProxyPropertyDescriptor(this, m)).ToArray();
     _propertyCollection = new PropertyDescriptorCollection(_properties);
     _events = new EventDescriptorCollection(type.GetEvents().Select(e => new ProxyEventDescriptor(e)).ToArray());
 }
コード例 #4
0
ファイル: MemberMeta.cs プロジェクト: Railgun-it/Assisticant
 public MemberMeta(TypeMeta owner, string name, Type type)
 {
     DeclaringType = owner;
     Name = name;
     MemberType = type;
     IsViewModel = ViewModelTypes.IsViewModel(type);
     IsCollection = typeof(IEnumerable).IsAssignableFromPortable(MemberType) && MemberType != typeof(string);
 }
コード例 #5
0
 public MemberMeta(TypeMeta owner, string name, Type type)
 {
     DeclaringType = owner;
     Name          = name;
     MemberType    = type;
     IsViewModel   = ViewModelTypes.IsViewModel(type);
     IsCollection  = typeof(IEnumerable).IsAssignableFromPortable(MemberType) && MemberType != typeof(string);
 }
コード例 #6
0
ファイル: CommandMeta.cs プロジェクト: Railgun-it/Assisticant
 internal static IEnumerable<MemberMeta> GetAll(TypeMeta owner, IEnumerable<MemberMeta> properties)
 {
     var conditions = (from property in properties
                       where property.MemberType == typeof(bool) && property.Name.StartsWith("Can")
                       select property).ToList();
     return from method in owner.Type.GetMethodsPortable()
            where method.IsPublic && !method.IsStatic && !method.IsSpecialName && method.ReturnType == typeof(void) && method.GetParameters().Length <= 1
            select new CommandMeta(owner, method, conditions.FirstOrDefault(c => c.Name == "Can" + method.Name));
 }
コード例 #7
0
        internal static IEnumerable <MemberMeta> GetAll(TypeMeta owner, IEnumerable <MemberMeta> properties)
        {
            var conditions = (from property in properties
                              where property.MemberType == typeof(bool) && property.Name.StartsWith("Can")
                              select property).ToList();

            return(from method in owner.Type.GetMethodsPortable()
                   where method.IsPublic && !method.IsStatic && !method.IsSpecialName && method.ReturnType == typeof(void) && method.GetParameters().Length <= 1
                   select new CommandMeta(owner, method, conditions.FirstOrDefault(c => c.Name == "Can" + method.Name)));
        }
コード例 #8
0
        PropertyMeta(TypeMeta owner, PropertyInfo property)
            : base(owner, property.Name, property.PropertyType)
        {
            Property = property;

            _earlierPropertyNames = property
                                    .GetCustomAttributesPortable <NotifyAfterAttribute>()
                                    .Select(a => a.OtherProperty)
                                    .ToList();
        }
コード例 #9
0
 public MemberMeta(TypeMeta owner, string name, Type type)
 {
     DeclaringType          = owner;
     Name                   = name;
     MemberType             = type;
     IsViewModel            = ViewModelTypes.IsViewModel(type);
     IsCollection           = typeof(IEnumerable).IsAssignableFromPortable(MemberType) && MemberType != typeof(string);
     IsObservableCollection = typeof(INotifyCollectionChanged).IsAssignableFromPortable(type) ||
                              IsBindingList(type);
 }
コード例 #10
0
ファイル: TypeMeta.cs プロジェクト: Railgun-it/Assisticant
 public static TypeMeta Get(Type type)
 {
     TypeMeta result;
     lock (_cache)
     {
         if (!_cache.TryGetValue(type, out result))
             _cache[type] = result = new TypeMeta(type);
     }
     return result;
 }
コード例 #11
0
ファイル: TypeMeta.cs プロジェクト: smasihemami/Assisticant
        public static TypeMeta Get(Type type)
        {
            TypeMeta result;

            lock (_cache)
            {
                if (!_cache.TryGetValue(type, out result))
                {
                    _cache[type] = result = new TypeMeta(type);
                }
            }
            return(result);
        }
コード例 #12
0
 internal static IEnumerable <MemberMeta> GetAll(TypeMeta owner)
 {
     return(from property in owner.Type.GetPropertiesPortable()
            where property.CanRead && property.GetGetMethodPortable().IsPublic&& !property.GetGetMethodPortable().IsStatic
            select new PropertyMeta(owner, property));
 }
コード例 #13
0
 FieldMeta(TypeMeta owner, FieldInfo field)
     : base(owner, field.Name, field.FieldType)
 {
     Field = field;
 }
コード例 #14
0
 protected ViewProxy(object instance, TypeMeta type)
 {
     Instance = instance;
     _slots   = (from member in type.Members
                 select MemberSlot.Create(this, member)).ToArray();
 }
コード例 #15
0
ファイル: FieldMeta.cs プロジェクト: Railgun-it/Assisticant
 internal static IEnumerable<MemberMeta> GetAll(TypeMeta owner)
 {
     return from field in owner.Type.GetFieldsPortable()
            where field.IsPublic && !field.IsStatic
            select new FieldMeta(owner, field);
 }
コード例 #16
0
ファイル: FieldMeta.cs プロジェクト: Railgun-it/Assisticant
 FieldMeta(TypeMeta owner, FieldInfo field)
     : base(owner, field.Name, field.FieldType)
 {
     Field = field;
 }
コード例 #17
0
 PropertyMeta(TypeMeta owner, PropertyInfo property)
     : base(owner, property.Name, property.PropertyType)
 {
     Property = property;
 }
コード例 #18
0
 internal static IEnumerable <MemberMeta> GetAll(TypeMeta owner)
 {
     return(from field in owner.Type.GetFieldsPortable()
            where field.IsPublic && !field.IsStatic
            select new FieldMeta(owner, field));
 }
コード例 #19
0
 internal static IEnumerable<MemberMeta> GetAll(TypeMeta owner)
 {
     return from property in owner.Type.GetPropertiesPortable()
            where property.CanRead && property.GetGetMethodPortable().IsPublic && !property.GetGetMethodPortable().IsStatic
            select new PropertyMeta(owner, property);
 }
コード例 #20
0
 PropertyMeta(TypeMeta owner, PropertyInfo property)
     : base(owner, property.Name, property.PropertyType)
 {
     Property = property;
 }
コード例 #21
0
 protected PlatformProxy(object instance, TypeMeta type)
     : base(instance, type)
 {
 }
コード例 #22
0
 ProxyXamlType(TypeMeta meta)
 {
     _meta = meta;
     _underlyingType = typeof(PlatformProxy<>).MakeGenericType(meta.Type);
     _members = meta.Members.Select(m => new ProxyXamlMember(this, m)).ToDictionary(m => m.Name);
 }