public Task <IReadOnlyList <ITypeInfo> > GetAssignableTypesAsync(IPropertyInfo property)
        {
            return(Task.Run(() => {
                ReflectionPropertyInfo realInfo = (ReflectionPropertyInfo)property;
                var assemblies = AppDomain.CurrentDomain.GetAssemblies();
                var entry = Assembly.GetEntryAssembly();

                return (IReadOnlyList <ITypeInfo>)assemblies.Select(a => new { Assembly = a, Info = new AssemblyInfo(a.FullName, a == entry) })
                .SelectMany(a =>
                            a.Assembly.DefinedTypes.Select(t => new { Type = t, Assembly = a }))
                .AsParallel()
                .Where(t => realInfo.Type.IsAssignableFrom(t.Type))
                .Select(t => new TypeInfo(t.Assembly.Info, t.Type.Namespace, t.Type.Name)).ToList();
            }));
        }
Exemple #2
0
        public Task <ITypeInfo> GetValueTypeAsync(IPropertyInfo property, PropertyVariation variations = null)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            ReflectionPropertyInfo info = property as ReflectionPropertyInfo;

            if (info == null)
            {
                throw new ArgumentException();
            }

            return(Task.FromResult(info.GetValueType(Target)));
        }
        public async Task SetValueAsync <T> (IPropertyInfo property, ValueInfo <T> value, PropertyVariation variation = null)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            ReflectionPropertyInfo info = property as ReflectionPropertyInfo;

            if (info == null)
            {
                throw new ArgumentException();
            }

            await info.SetValueAsync(this.target, value.Value);

            OnPropertyChanged(info);
        }
        public async Task <ValueInfo <T> > GetValueAsync <T> (IPropertyInfo property, PropertyVariation variation = null)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            ReflectionPropertyInfo info = property as ReflectionPropertyInfo;

            if (info == null)
            {
                throw new ArgumentException();
            }

            T value = await info.GetValueAsync <T> (this.target);

            return(new ValueInfo <T> {
                Source = ValueSource.Local,
                Value = value
            });
        }