예제 #1
0
        private static IList <ReferenceStep> GetBindablePropertiesInternal(SceneNode sceneNode, int maxCount, BindingPropertyHelper.BindingType bindingType)
        {
            List <ReferenceStep> list = new List <ReferenceStep>();

            if (!BindingPropertyHelper.IsBindableSceneNode(sceneNode))
            {
                return((IList <ReferenceStep>)list);
            }
            bool isDeclaringTypeBindable = BindingPropertyHelper.IsBindableType(sceneNode.Type.NearestResolvedType, bindingType);

            foreach (TargetedReferenceStep targetedReferenceStep in (IEnumerable <TargetedReferenceStep>)PropertyMerger.GetMergedProperties((IEnumerable <SceneNode>) new SceneNode[1]
            {
                sceneNode
            }))
            {
                if ((!BindingPropertyHelper.IsTargetMode(bindingType) || BindingPropertyHelper.IsPropertyBindableAsTarget(sceneNode, targetedReferenceStep.ReferenceStep, isDeclaringTypeBindable)) && (!BindingPropertyHelper.IsSourceMode(bindingType) || BindingPropertyHelper.IsPropertyBindableAsSource(sceneNode, targetedReferenceStep.ReferenceStep)))
                {
                    list.Add(targetedReferenceStep.ReferenceStep);
                    if (list.Count >= maxCount)
                    {
                        break;
                    }
                }
            }
            return((IList <ReferenceStep>)list);
        }
예제 #2
0
        private static bool IsPropertyBindable(SceneNode sceneNode, PropertyReference propertyReference, BindingPropertyHelper.BindingType type)
        {
            if (!BindingPropertyHelper.IsBindableSceneNode(sceneNode))
            {
                return(false);
            }
            ReferenceStep lastStep = propertyReference.LastStep;

            if (BindingPropertyHelper.IsTargetMode(type))
            {
                bool isDeclaringTypeBindable = propertyReference.Count <= 1 ? BindingPropertyHelper.IsBindableType(sceneNode.Type.NearestResolvedType, BindingPropertyHelper.BindingType.Target) : BindingPropertyHelper.IsBindableType(lastStep.DeclaringType, BindingPropertyHelper.BindingType.Target);
                if (!BindingPropertyHelper.IsPropertyBindableAsTarget(sceneNode, lastStep, isDeclaringTypeBindable))
                {
                    return(false);
                }
            }
            return(!BindingPropertyHelper.IsSourceMode(type) || BindingPropertyHelper.IsPropertyBindableAsSource(sceneNode, lastStep));
        }