示例#1
0
 public void SetValue(ITypeResolver typeResolver, PropertyReference propertyReference, object value)
 {
     if (this.viewObject != null)
     {
         propertyReference = DesignTimeProperties.GetAppliedShadowPropertyReference(propertyReference, typeResolver.GetType(this.TargetType));
         propertyReference.SetValue(this.viewObject, value);
     }
 }
示例#2
0
        protected override object GetComputedValueInternal(PropertyReference propertyReference)
        {
            PropertyReference propertyReference1 = this.GetMediaTimelinePropertyReference(propertyReference);

            if (propertyReference1 != null)
            {
                MediaTimelineSceneNode owningTimeline = this.OwningTimeline;
                if (owningTimeline != null)
                {
                    ViewState viewState = ViewState.ElementValid | ViewState.AncestorValid | ViewState.SubtreeValid;
                    if (!owningTimeline.ViewModel.DefaultView.IsValid || (owningTimeline.ViewModel.DefaultView.GetViewState((SceneNode)owningTimeline) & viewState) != viewState || propertyReference1.LastStep == MediaTimelineSceneNode.SourceProperty)
                    {
                        return(owningTimeline.GetLocalOrDefaultValue(propertyReference1));
                    }
                    IViewObject viewObject = owningTimeline.ViewModel.GetViewObject(owningTimeline.DocumentNodePath);
                    propertyReference = DesignTimeProperties.GetAppliedShadowPropertyReference(propertyReference, (ITypeId)owningTimeline.TargetElement.Type);
                    return(propertyReference1.GetCurrentValue(viewObject.PlatformSpecificObject));
                }
            }
            return(base.GetComputedValueInternal(propertyReference));
        }
示例#3
0
        protected override object GetRawComputedValueInternal(PropertyReference propertyReference)
        {
            if (this.IsStyleProperty(propertyReference))
            {
                return(base.GetRawComputedValueInternal(propertyReference));
            }
            IViewObject viewTargetElement = this.ViewTargetElement;

            if (viewTargetElement == null || !PlatformTypes.FrameworkElement.IsAssignableFrom((ITypeId)viewTargetElement.GetIType((ITypeResolver)this.ProjectContext)))
            {
                ReferenceStep referenceStep = propertyReference[propertyReference.Count - 1];
                return(referenceStep.GetDefaultValue(PlatformTypeHelper.GetDeclaringType((IMember)referenceStep)));
            }
            PropertyReference propertyReference1 = DesignTimeProperties.GetAppliedShadowPropertyReference(propertyReference, (ITypeId)this.Type);

            if (propertyReference1 != propertyReference && !DesignTimeProperties.UseShadowPropertyForInstanceBuilding(this.DocumentContext.TypeResolver, (IPropertyId)propertyReference[0]))
            {
                return(SceneNode.GetComputedValueWithShadowCoercion(propertyReference, propertyReference, viewTargetElement.PlatformSpecificObject));
            }
            return(this.GetCurrentValueFromPropertyReference(propertyReference1, viewTargetElement.PlatformSpecificObject));
        }
示例#4
0
        public void ReverseKeyFrames(double startTime, double endTime)
        {
            if (this.KeyFrameCount == 0)
            {
                return;
            }
            this.ConvertKeySplineResourcesToLocalValues();
            int capacity = 0;
            IList <KeyFrameSceneNode> keyFrameCollection = this.KeyFrameCollection;
            int index1 = 0;

            while (index1 < keyFrameCollection.Count && keyFrameCollection[index1].Time < startTime)
            {
                ++index1;
            }
            int index2 = index1;

            for (; index1 < keyFrameCollection.Count && keyFrameCollection[index1].Time <= endTime; ++index1)
            {
                ++capacity;
            }
            if (capacity == 0)
            {
                return;
            }
            bool flag = startTime == 0.0 && keyFrameCollection[0].Time != 0.0;

            if (flag)
            {
                ++capacity;
            }
            List <KeyFrameSceneNode> list1 = new List <KeyFrameSceneNode>(capacity);
            List <Point?>            list2 = new List <Point?>(capacity);

            if (flag)
            {
                KeyFrameSceneNode keyFrameSceneNode = this.IsDiscreteOnly ? (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Discrete)) : (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Spline));
                keyFrameSceneNode.Time = 0.0;
                SceneElement sceneElement = this.TargetElement as SceneElement;
                IViewObject  viewObject   = sceneElement.ViewTargetElement;
                if (PlatformTypes.Viewport3D.Equals((object)viewObject.GetIType((ITypeResolver)this.ProjectContext)))
                {
                    viewObject = sceneElement.ViewObject;
                }
                PropertyReference propertyReference = DesignTimeProperties.GetAppliedShadowPropertyReference(this.TargetProperty, (ITypeId)this.Type);
                keyFrameSceneNode.Value = viewObject.GetBaseValue(propertyReference);
                list1.Add(keyFrameSceneNode);
                if (keyFrameCollection[0].InterpolationType == KeyFrameInterpolationType.Spline && keyFrameCollection[0].KeySpline != null)
                {
                    list2.Add(new Point?(keyFrameCollection[0].KeySpline.ControlPoint1));
                }
                else if (!this.IsDiscreteOnly)
                {
                    list2.Add(new Point?(new Point()));
                }
                else
                {
                    list2.Add(new Point?());
                }
            }
            int num1 = 0;

            while (list1.Count < capacity)
            {
                if (keyFrameCollection[index2].InterpolationType != KeyFrameInterpolationType.Discrete)
                {
                    list2.Add(new Point?(keyFrameCollection[index2].EaseOutControlPoint));
                }
                else
                {
                    list2.Add(new Point?());
                }
                list1.Add(keyFrameCollection[index2]);
                keyFrameCollection.RemoveAt(index2);
                ++num1;
            }
            for (int index3 = 0; index3 < list1.Count; ++index3)
            {
                KeyFrameSceneNode keyFrameSceneNode1 = list1[index3];
                Point?            nullable1          = list2[index3];
                Point?            nullable2          = new Point?();
                if (keyFrameSceneNode1.InterpolationType != KeyFrameInterpolationType.Discrete)
                {
                    nullable2 = new Point?(keyFrameSceneNode1.EaseInControlPoint);
                }
                double            num2 = endTime - (keyFrameSceneNode1.Time - startTime);
                KeyFrameSceneNode node;
                if (nullable1.HasValue)
                {
                    KeyFrameSceneNode keyFrameSceneNode2 = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Spline));
                    keyFrameSceneNode2.ValueNode = keyFrameSceneNode1.ValueNode.Clone(keyFrameSceneNode2.DocumentContext);
                    node = keyFrameSceneNode2;
                    node.EaseInControlPoint = new Point(1.0 - nullable1.Value.X, 1.0 - nullable1.Value.Y);
                }
                else
                {
                    KeyFrameSceneNode keyFrameSceneNode2 = (KeyFrameSceneNode)KeyFrameSceneNode.Factory.Instantiate(this.ViewModel, this.GetKeyFrameType(KeyFrameInterpolationType.Discrete));
                    keyFrameSceneNode2.ValueNode = keyFrameSceneNode1.ValueNode.Clone(keyFrameSceneNode2.DocumentContext);
                    node = keyFrameSceneNode2;
                }
                node.Time = num2;
                keyFrameCollection.Insert(index2, node);
                if (nullable2.HasValue)
                {
                    Point newEaseOut = new Point(1.0 - nullable2.Value.X, 1.0 - nullable2.Value.Y);
                    KeyFrameSceneNode.SetEaseOutControlPoint(node, newEaseOut);
                }
            }
            if (!flag)
            {
                return;
            }
            Point?nullable = new Point?(keyFrameCollection[0].EaseOutControlPoint);

            if (nullable.HasValue)
            {
                this.SetHandoffKeyFrameEaseOutPoint(nullable.Value);
            }
            this.RemoveKeyFrame(0.0);
        }