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); }
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)); }
protected override DocumentNode CreateValue(BaseFrameworkElement source) { object tileBrush = this.CreateTileBrush(source); if (tileBrush == null) { return((DocumentNode)null); } ITypeResolver typeResolver = (ITypeResolver)source.ProjectContext; IViewObject visual = source.Visual; if (visual != null) { object platformSpecificObject = visual.PlatformSpecificObject; if (platformSpecificObject != null && PlatformTypes.Image.IsAssignableFrom((ITypeId)visual.GetIType((ITypeResolver)this.SceneViewModel.ProjectContext))) { ReferenceStep referenceStep = typeResolver.ResolveProperty(TileBrushNode.StretchProperty) as ReferenceStep; object obj = referenceStep.GetValue(tileBrush); object valueToSet = (typeResolver.ResolveProperty(ImageElement.StretchProperty) as ReferenceStep).GetValue(platformSpecificObject); if (!obj.Equals(valueToSet)) { referenceStep.SetValue(tileBrush, valueToSet); } } } return(this.SceneViewModel.Document.DocumentContext.CreateNode(typeResolver.ResolveType(PlatformTypes.TileBrush).RuntimeType, tileBrush)); }
public static bool GetUseLayoutRounding(SceneElement element) { if (element != null && element.Type != null) { IProperty propertyKey = LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)element); if (propertyKey != null) { if (propertyKey.DeclaringType.IsAssignableFrom((ITypeId)element.Type)) { return((bool)element.GetComputedValue((IPropertyId)propertyKey)); } FrameworkTemplateElement frameworkTemplateElement = element as FrameworkTemplateElement; if (frameworkTemplateElement != null) { IViewObject viewTargetElement = frameworkTemplateElement.ViewTargetElement; if (viewTargetElement != null && propertyKey.DeclaringType.IsAssignableFrom((ITypeId)viewTargetElement.GetIType((ITypeResolver)element.ProjectContext))) { return((bool)viewTargetElement.GetCurrentValue(propertyKey)); } } } } return(false); }