public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags flags)
        {
            if (!DictionaryEntryNode.ValueProperty.Equals((object)propertyReference[0]))
            {
                return(base.GetValue(propertyReference, flags));
            }
            object target = (object)null;

            if (this.IsEditable)
            {
                IViewObject correspondingViewObject = this.ViewModel.DefaultView.GetCorrespondingViewObject(this.RepresentativeSceneNode.DocumentNodePath);
                object      obj = correspondingViewObject != null ? correspondingViewObject.PlatformSpecificObject : (object)null;
                if (obj != null && obj is DictionaryEntry)
                {
                    target = ((DictionaryEntry)obj).Value;
                }
            }
            if (target == null)
            {
                this.EnsureInstanceBuilderContext();
                using (this.context.DisablePostponedResourceEvaluation())
                {
                    this.context.ViewNodeManager.RootNodePath = new DocumentNodePath(this.resource.Resource.ValueNode, this.resource.Resource.ValueNode);
                    this.context.ViewNodeManager.Instantiate(this.context.ViewNodeManager.Root);
                    target = this.context.ViewNodeManager.ValidRootInstance;
                }
            }
            if (target != null && propertyReference.Count > 1)
            {
                target = propertyReference.PartialGetValue(target, 1, propertyReference.Count - 1);
            }
            return(target);
        }
Exemple #2
0
 public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
 {
     try
     {
         if (this.objects.Length == 0)
         {
             return(this.parent.GetValue(this.baseReference.Append(propertyReference), getValueFlags));
         }
         return(base.GetValue(propertyReference, getValueFlags));
     }
     catch (IndexOutOfRangeException ex)
     {
     }
     catch (ArgumentOutOfRangeException ex)
     {
     }
     catch (TargetInvocationException ex)
     {
         if (ex.InnerException != null)
         {
             if (!(ex.InnerException is IndexOutOfRangeException))
             {
                 if (!(ex.InnerException is ArgumentOutOfRangeException))
                 {
                     throw;
                 }
             }
         }
     }
     return(propertyReference.LastStep.GetDefaultValue(this.ObjectType));
 }
 public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
 {
     if (propertyReference[0] == this.targetStep)
     {
         TypeConverter typeConverter = this.redirectedProperty.TypeConverter;
         object        target        = base.GetValue(new PropertyReference(this.targetStep), getValueFlags);
         if (target == null)
         {
             Type runtimeType = this.redirectedProperty.PropertyType.RuntimeType;
             if (runtimeType != (Type)null && runtimeType.IsValueType)
             {
                 target = Activator.CreateInstance(runtimeType);
             }
         }
         if (target != null && typeConverter != null && typeConverter.CanConvertFrom(target.GetType()))
         {
             target = typeConverter.ConvertFrom(target);
         }
         if (target != null)
         {
             if (propertyReference.Count > 1)
             {
                 return(propertyReference.PartialGetValue(target, 1, propertyReference.Count - 1));
             }
             return(target);
         }
     }
     return(base.GetValue(propertyReference, getValueFlags));
 }
Exemple #4
0
 public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
 {
     if ((getValueFlags & PropertyReference.GetValueFlags.Computed) != PropertyReference.GetValueFlags.Local)
     {
         return(propertyReference.GetCurrentValue(this.localValue));
     }
     return(propertyReference.GetBaseValue(this.localValue));
 }
Exemple #5
0
        public override object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
        {
            object second = null;
            bool   flag   = false;

            foreach (SceneNode sceneNode in this.Objects)
            {
                PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode, propertyReference);
                if (propertyReference1 != null)
                {
                    object first;
                    if ((getValueFlags & PropertyReference.GetValueFlags.Computed) != PropertyReference.GetValueFlags.Local)
                    {
                        if (SceneNodeObjectSetBase.IsValidForGetComputedValue(sceneNode))
                        {
                            first = sceneNode.GetComputedValue(propertyReference1);
                        }
                        else
                        {
                            SceneNode         ancestor           = (SceneNode)null;
                            PropertyReference propertyReference2 = propertyReference1;
                            first = !this.ShouldWalkParentsForGetValue || !this.FindAncestor(sceneNode, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsValidForGetComputedValue)) ? sceneNode.GetLocalOrDefaultValue(propertyReference1) : ancestor.GetComputedValue(propertyReference2);
                        }
                    }
                    else
                    {
                        first = sceneNode.GetLocalOrDefaultValue(propertyReference1);
                    }
                    if (!flag)
                    {
                        second = first;
                        flag   = true;
                    }
                    else if (!PropertyUtilities.Compare(first, second, sceneNode.ViewModel.DefaultView))
                    {
                        second = MixedProperty.Mixed;
                        break;
                    }
                }
            }
            if (!flag)
            {
                ReferenceStep referenceStep = propertyReference[propertyReference.Count - 1];
                if (this.designerContext.ActiveView != null)
                {
                    second = referenceStep.GetDefaultValue(referenceStep.TargetType);
                }
            }
            return(second);
        }
        public object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags flags)
        {
            object second = null;
            bool   flag   = false;

            SceneNode[] selectedNodes = this.designerContext.SelectionManager.SelectedNodes;
            if (selectedNodes != null && selectedNodes.Length > 0)
            {
                foreach (SceneNode node in selectedNodes)
                {
                    PropertyReference propertyReference1 = this.FilterProperty(node, propertyReference);
                    if (propertyReference1 != null)
                    {
                        object obj = (flags & PropertyReference.GetValueFlags.Computed) == PropertyReference.GetValueFlags.Local ? node.GetLocalValue(propertyReference1) : node.GetComputedValue(propertyReference1);
                        if (!flag)
                        {
                            second = this.CopyIfFreezable(obj);
                            flag   = true;
                        }
                        else if (!PropertyUtilities.Compare(obj, second, node.ViewModel.DefaultView))
                        {
                            second = MixedProperty.Mixed;
                            break;
                        }
                    }
                }
            }
            if (!flag)
            {
                if (this.designerContext.AmbientPropertyManager.IsAmbientProperty(propertyReference))
                {
                    second = this.designerContext.AmbientPropertyManager.GetAmbientValue(propertyReference);
                }
                else
                {
                    ReferenceStep referenceStep = propertyReference[propertyReference.Count - 1];
                    second = referenceStep.GetDefaultValue(referenceStep.TargetType);
                }
            }
            return(second);
        }
Exemple #7
0
        public override DocumentNode GetRawValue(IDocumentContext documentContext, PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags)
        {
            object obj = this.GetValue(propertyReference, getValueFlags);

            if (obj != null)
            {
                return(documentContext.CreateNode(obj.GetType(), obj));
            }
            return((DocumentNode)null);
        }
Exemple #8
0
 public object GetValue(PropertyReferenceProperty property, PropertyReference.GetValueFlags getValueFlags)
 {
     return(this.GetValue(property.Reference, getValueFlags));
 }
Exemple #9
0
 public abstract DocumentNode GetRawValue(IDocumentContext documentContext, PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags);
Exemple #10
0
 public abstract object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags getValueFlags);