public static ReferenceStep GetProperty(ITypeResolver typeResolver, ITypeId typeId, MemberType memberTypes, string memberName) { IType typeId1 = typeResolver.ResolveType(typeId); if (typeResolver.PlatformMetadata.IsNullType((ITypeId)typeId1)) { return((ReferenceStep)null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, typeId1); return((ReferenceStep)typeId1.GetMember(memberTypes & MemberType.Property, memberName, allowableMemberAccess)); }
public static IEvent GetEvent(ITypeResolver typeResolver, Type targetType, string memberName) { IType type = typeResolver.GetType(targetType); if (type == null) { return((IEvent)null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, type); return((IEvent)type.GetMember(MemberType.Event, memberName, allowableMemberAccess)); }
public static IMemberId GetRoutedCommandMember(ITypeResolver typeResolver, Type type, string commandName) { IType type1 = typeResolver.GetType(type); if (type1 == null) { return((IMemberId)null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, type1); return(type1.GetMember(MemberType.LocalProperty | MemberType.Field, commandName, allowableMemberAccess) ?? type1.GetMember(MemberType.LocalProperty | MemberType.Field, commandName + "Command", allowableMemberAccess)); }
public static bool IsPropertyWritable(ITypeResolver typeResolver, IProperty propertyKey, bool allowProtectedProperties) { MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, propertyKey.DeclaringType); if (allowProtectedProperties && !propertyKey.IsAttachable || typeResolver.IsCapabilitySet(PlatformCapability.WorkaroundSL12782) && typeResolver.PlatformMetadata.KnownTypes.UserControl.IsAssignableFrom(propertyKey.DeclaringTypeId) && propertyKey.Equals((object)propertyKey.DeclaringType.Metadata.DefaultContentProperty)) { allowableMemberAccess |= MemberAccessTypes.Protected; } MemberAccessType writeAccess = propertyKey.WriteAccess; return(TypeHelper.IsSet(allowableMemberAccess, writeAccess)); }
public static IEvent GetEvent(ITypeResolver typeResolver, RoutedEvent routedEvent) { IType type = typeResolver.GetType(routedEvent.OwnerType); if (type != null) { MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, type); Event @event = (Event)type.GetMember(MemberType.Event, routedEvent.Name, allowableMemberAccess); if (@event != null && @event.RoutedEvent == routedEvent) { return((IEvent)@event); } } return((IEvent)null); }
private static ReferenceStep GetContentProperty(ITypeResolver typeResolver, Type type, string propertyName) { IType type1 = typeResolver.GetType(type); if (type1 == null) { return(null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, type1); if (PlatformTypes.UserControl.IsAssignableFrom(type1)) { allowableMemberAccess = allowableMemberAccess | MemberAccessTypes.Protected; } return((ReferenceStep)type1.GetMember(MemberType.Property, propertyName, allowableMemberAccess)); }
public static IProperty GetProperty(ITypeResolver typeResolver, Type targetType, PropertyDescriptor propertyDescriptor) { if (typeResolver.IsCapabilitySet(PlatformCapability.UseDependencyPropertyDescriptor)) { DependencyPropertyDescriptor propertyDescriptor1 = DependencyPropertyDescriptor.FromProperty(propertyDescriptor); if (propertyDescriptor1 != null) { return((IProperty)DependencyPropertyReferenceStep.GetReferenceStep(typeResolver, targetType, propertyDescriptor1.DependencyProperty)); } } IType type = typeResolver.GetType(targetType); if (typeResolver.PlatformMetadata.IsNullType((ITypeId)type)) { return((IProperty)null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(typeResolver, type); return(type.GetMember(MemberType.Property, propertyDescriptor.Name, allowableMemberAccess) as IProperty); }
public static bool IsAccessibleType(ITypeResolver typeResolver, IType typeId) { return(TypeHelper.IsSet(TypeHelper.GetAllowableMemberAccess(typeResolver, typeId), typeId.Access)); }