// Token: 0x060064D7 RID: 25815 RVA: 0x001C4A4C File Offset: 0x001C2C4C internal static void StoreItemValues(IContainItemStorage owner, DependencyObject container, object item) { int[] itemValueStorageIndices = Helper.ItemValueStorageIndices; DependencyObject owner2 = (DependencyObject)owner; foreach (int num in itemValueStorageIndices) { EntryIndex entryIndex = container.LookupEntry(num); if (entryIndex.Found) { EffectiveValueEntry effectiveValueEntry = container.EffectiveValues[(int)entryIndex.Index]; if ((effectiveValueEntry.BaseValueSourceInternal == BaseValueSourceInternal.Local || effectiveValueEntry.BaseValueSourceInternal == BaseValueSourceInternal.ParentTemplate) && !effectiveValueEntry.HasModifiers) { Helper.StoreItemValue(owner2, item, num, effectiveValueEntry.Value); } else if (effectiveValueEntry.IsCoercedWithCurrentValue) { Helper.StoreItemValue(owner2, item, num, new Helper.ModifiedItemValue(effectiveValueEntry.ModifiedValue.CoercedValue, FullValueSource.IsCoercedWithCurrentValue)); } else { Helper.ClearItemValue(owner2, item, num); } } } }
/// <summary> /// Allows subclasses to participate in property animated value computation /// </summary> /// <param name="dp"></param> /// <param name="metadata"></param> /// <param name="entry">EffectiveValueEntry computed by base</param> internal sealed override void EvaluateAnimatedValueCore( DependencyProperty dp, PropertyMetadata metadata, ref EffectiveValueEntry entry) { if (IAnimatable_HasAnimatedProperties) { AnimationStorage storage = AnimationStorage.GetStorage(this, dp); if (storage != null) { storage.EvaluateAnimatedValue(metadata, ref entry); } } }
internal void EvaluateAnimatedValue( PropertyMetadata metadata, ref EffectiveValueEntry entry) { DependencyObject d = (DependencyObject)_dependencyObject.Target; if (d == null) { return; } object value = entry.GetFlattenedEntry(RequestFlags.FullyResolved).Value; if (entry.IsDeferredReference) { DeferredReference dr = (DeferredReference)value; value = dr.GetValue(entry.BaseValueSourceInternal); // Set the baseValue back into the entry entry.SetAnimationBaseValue(value); } object animatedValue = GetCurrentPropertyValue(this, d, _dependencyProperty, metadata, value); if (!_dependencyProperty.IsValidValueInternal(animatedValue)) { // If the animation(s) applied to the property have calculated an // invalid value for the property then raise an exception. throw new InvalidOperationException( SR.Get( SRID.Animation_CalculatedValueIsInvalidForProperty, _dependencyProperty.Name, null)); } entry.SetAnimatedValue(animatedValue, value); }
internal sealed override void EvaluateAnimatedValueCore( DependencyProperty dp, PropertyMetadata metadata, ref EffectiveValueEntry entry) { if (IAnimatable_HasAnimatedProperties) { AnimationStorage storage = AnimationStorage.GetStorage(this, dp); if (storage != null) { storage.EvaluateAnimatedValue(metadata, ref entry); } } }
/// <summary> /// Check to see if there is a complex path that started with the /// given target object and property. If so, process the complex path /// information and return the results. /// </summary> internal static void GetComplexPathValue( DependencyObject targetObject, DependencyProperty targetProperty, ref EffectiveValueEntry entry, PropertyMetadata metadata) { CloneCacheEntry cacheEntry = GetComplexPathClone(targetObject, targetProperty); if (cacheEntry != null) { object baseValue = entry.Value; if (baseValue == DependencyProperty.UnsetValue) { // If the incoming baseValue is DependencyProperty.UnsetValue, that // means the current property value is the default value. Either // the cacheEntry.Clone was a clone of a default value (and should be // returned to the caller) or someone called ClearValue() (and // cacheEntry.Clone should be cleared accordingly). // To distinguish these cases we must check the cached source // against the default value. // // We don't have to handle the ClearValue case in this clause; // the comparison with the cached source to the base value // will fail in that case (since the cached source won't be UnsetValue) // and we'll clear out the cache. Debug.Assert(cacheEntry.Source != DependencyProperty.UnsetValue, "Storyboard complex path’s clone cache should never contain DependencyProperty.UnsetValue. Either something went wrong in Storyboard.ProcessComplexPath() or somebody else is messing with the Storyboard clone cache."); if (cacheEntry.Source == metadata.GetDefaultValue(targetObject, targetProperty)) { // The cacheEntry.Clone is the clone of the default value. In normal // non-Storyboard code paths, BaseValueSourceInternal is Unknown for default // values at this time, so we need to switch it over explicitly. // // And to prevent DependencyObject.UpdateEffectiveValue from misconstruing this // as an unaltered default value (which would result in UEV thinking no change // in value occurred and discarding this new value), we will go ahead and set the // animated value modifier on this value entry. (jeffbog: B#1616678 5/19/2006) // // In all other cases, valueSource should have the correct // valueSource corresponding to the object we cloned from, // so we don't need to do anything. entry.BaseValueSourceInternal = BaseValueSourceInternal.Default; entry.SetAnimatedValue(cacheEntry.Clone, DependencyProperty.UnsetValue); return; } } // If the incoming baseValue is a deferred object, we need to get the // real value to make a valid comparison against the cache entry source. DeferredReference deferredBaseValue = baseValue as DeferredReference; if (deferredBaseValue != null) { baseValue = deferredBaseValue.GetValue(entry.BaseValueSourceInternal); entry.Value = baseValue; } // If the incoming baseValue is different from the original source object that // we cloned and cached then we need to invalidate this cache. Otherwise we use // the value in the cache as is. if (cacheEntry.Source == baseValue) { CloneEffectiveValue(ref entry, cacheEntry); return; } else { // Setting to DependencyProperty.UnsetValue is how FrugalMap does delete. SetComplexPathClone( targetObject, targetProperty, DependencyProperty.UnsetValue, DependencyProperty.UnsetValue); } } }
private static void CloneEffectiveValue(ref EffectiveValueEntry entry, CloneCacheEntry cacheEntry) { object clonedValue = cacheEntry.Clone; /* if (!entry.IsExpression) { if (entry.LocalValue != clonedValue) { entry.Value = clonedValue; } } else { ModifiedValue modifiedValue = entry.ModifiedValue; if (modifiedValue.ExpressionValue != clonedValue) { modifiedValue.ExpressionValue = clonedValue; } } */ if (!entry.IsExpression) { entry.Value = clonedValue; } else { entry.ModifiedValue.ExpressionValue = clonedValue; } }
private void OnCurrentTimeInvalidated(object sender, EventArgs args) { object target = _dependencyObject.Target; if (target == null) { // If the target has been garbage collected, remove this handler // from the AnimationClock so that this collection can be // released also. DetachAnimationClock((AnimationClock)sender, _removeRequestedHandler); } else { // recompute animated value try { DependencyObject targetDO = ((DependencyObject)target); // fetch the existing entry EffectiveValueEntry oldEntry = targetDO.GetValueEntry( targetDO.LookupEntry(_dependencyProperty.GlobalIndex), _dependencyProperty, null, RequestFlags.RawEntry); EffectiveValueEntry newEntry; object value; // create a copy of that entry, removing animated & coerced values if (!oldEntry.HasModifiers) { // no modifiers; just use it, removing deferred references newEntry = oldEntry; value = newEntry.Value; if (newEntry.IsDeferredReference) { value = ((DeferredReference) value).GetValue(newEntry.BaseValueSourceInternal); newEntry.Value = value; } } else { // else entry has modifiers; preserve expression but throw away // coerced & animated values, since we'll be recomputing an animated value newEntry = new EffectiveValueEntry(); newEntry.BaseValueSourceInternal = oldEntry.BaseValueSourceInternal; newEntry.PropertyIndex = oldEntry.PropertyIndex; newEntry.HasExpressionMarker = oldEntry.HasExpressionMarker; value = oldEntry.ModifiedValue.BaseValue; if (oldEntry.IsDeferredReference) { DeferredReference dr = value as DeferredReference; if (dr != null) { value = dr.GetValue(newEntry.BaseValueSourceInternal); } } newEntry.Value = value; if (oldEntry.IsExpression) { value = oldEntry.ModifiedValue.ExpressionValue; if (oldEntry.IsDeferredReference) { DeferredReference dr = value as DeferredReference; if (dr != null) { value = dr.GetValue(newEntry.BaseValueSourceInternal); } } newEntry.SetExpressionValue(value, newEntry.Value); } } // compute the new value for the property PropertyMetadata metadata = _dependencyProperty.GetMetadata(targetDO.DependencyObjectType); object animatedValue = AnimationStorage.GetCurrentPropertyValue(this, targetDO, _dependencyProperty, metadata, value); if (_dependencyProperty.IsValidValueInternal(animatedValue)) { // update the new entry to contain the new animated value newEntry.SetAnimatedValue(animatedValue, value); // call UpdateEffectiveValue to put the new entry in targetDO's effective values table targetDO.UpdateEffectiveValue( targetDO.LookupEntry(_dependencyProperty.GlobalIndex), _dependencyProperty, metadata, oldEntry, ref newEntry, false /* coerceWithDeferredReference */, false /* coerceWithCurrentValue */, OperationType.Unknown); if (_hadValidationError) { if (TraceAnimation.IsEnabled) { TraceAnimation.TraceActivityItem( TraceAnimation.AnimateStorageValidationNoLongerFailing, this, animatedValue, target, _dependencyProperty); _hadValidationError = false; } } } else if(!_hadValidationError) { if (TraceAnimation.IsEnabled) { TraceAnimation.TraceActivityItem( TraceAnimation.AnimateStorageValidationFailed, this, animatedValue, target, _dependencyProperty); } _hadValidationError = true; } } catch (Exception e) { // Catch all exceptions thrown during the InvalidateProperty callstack // and wrap them in an AnimationException throw new AnimationException( (AnimationClock)sender, _dependencyProperty, (IAnimatable)target, SR.Get( SRID.Animation_Exception, _dependencyProperty.Name, target.GetType().FullName, ((AnimationClock)sender).Timeline.GetType().FullName), e); } } }
internal void EvaluateAnimatedValue( PropertyMetadata metadata, ref EffectiveValueEntry entry) { DependencyObject d = (DependencyObject)_dependencyObject.Target; if (d == null) { return; } object value = entry.GetFlattenedEntry(RequestFlags.FullyResolved).Value; if (entry.IsDeferredReference) { DeferredReference dr = (DeferredReference)value; value = dr.GetValue(entry.BaseValueSourceInternal); // Set the baseValue back into the entry entry.SetAnimationBaseValue(value); } object animatedValue = GetCurrentPropertyValue(this, d, _dependencyProperty, metadata, value); if (!_dependencyProperty.IsValidValueInternal(animatedValue)) { // If the animation(s) applied to the property have calculated an // invalid value for the property then raise an exception. throw new InvalidOperationException( SR.Get( SRID.Animation_CalculatedValueIsInvalidForProperty, _dependencyProperty.Name, null)); } entry.SetAnimatedValue(animatedValue, value); }
private void OnCurrentTimeInvalidated(object sender, EventArgs args) { object target = _dependencyObject.Target; if (target == null) { // If the target has been garbage collected, remove this handler // from the AnimationClock so that this collection can be // released also. DetachAnimationClock((AnimationClock)sender, _removeRequestedHandler); } else { // recompute animated value try { DependencyObject targetDO = ((DependencyObject)target); // fetch the existing entry EffectiveValueEntry oldEntry = targetDO.GetValueEntry( targetDO.LookupEntry(_dependencyProperty.GlobalIndex), _dependencyProperty, null, RequestFlags.RawEntry); EffectiveValueEntry newEntry; object value; // create a copy of that entry, removing animated & coerced values if (!oldEntry.HasModifiers) { // no modifiers; just use it, removing deferred references newEntry = oldEntry; value = newEntry.Value; if (newEntry.IsDeferredReference) { value = ((DeferredReference)value).GetValue(newEntry.BaseValueSourceInternal); newEntry.Value = value; } } else { // else entry has modifiers; preserve expression but throw away // coerced & animated values, since we'll be recomputing an animated value newEntry = new EffectiveValueEntry(); newEntry.BaseValueSourceInternal = oldEntry.BaseValueSourceInternal; newEntry.PropertyIndex = oldEntry.PropertyIndex; newEntry.HasExpressionMarker = oldEntry.HasExpressionMarker; value = oldEntry.ModifiedValue.BaseValue; if (oldEntry.IsDeferredReference) { DeferredReference dr = value as DeferredReference; if (dr != null) { value = dr.GetValue(newEntry.BaseValueSourceInternal); } } newEntry.Value = value; if (oldEntry.IsExpression) { value = oldEntry.ModifiedValue.ExpressionValue; if (oldEntry.IsDeferredReference) { DeferredReference dr = value as DeferredReference; if (dr != null) { value = dr.GetValue(newEntry.BaseValueSourceInternal); } } newEntry.SetExpressionValue(value, newEntry.Value); } } // compute the new value for the property PropertyMetadata metadata = _dependencyProperty.GetMetadata(targetDO.DependencyObjectType); object animatedValue = AnimationStorage.GetCurrentPropertyValue(this, targetDO, _dependencyProperty, metadata, value); if (_dependencyProperty.IsValidValueInternal(animatedValue)) { // update the new entry to contain the new animated value newEntry.SetAnimatedValue(animatedValue, value); // call UpdateEffectiveValue to put the new entry in targetDO's effective values table targetDO.UpdateEffectiveValue( targetDO.LookupEntry(_dependencyProperty.GlobalIndex), _dependencyProperty, metadata, oldEntry, ref newEntry, false /* coerceWithDeferredReference */, false /* coerceWithCurrentValue */, OperationType.Unknown); if (_hadValidationError) { if (TraceAnimation.IsEnabled) { TraceAnimation.TraceActivityItem( TraceAnimation.AnimateStorageValidationNoLongerFailing, this, animatedValue, target, _dependencyProperty); _hadValidationError = false; } } } else if (!_hadValidationError) { if (TraceAnimation.IsEnabled) { TraceAnimation.TraceActivityItem( TraceAnimation.AnimateStorageValidationFailed, this, animatedValue, target, _dependencyProperty); } _hadValidationError = true; } } catch (Exception e) { // Catch all exceptions thrown during the InvalidateProperty callstack // and wrap them in an AnimationException throw new AnimationException( (AnimationClock)sender, _dependencyProperty, (IAnimatable)target, SR.Get( SRID.Animation_Exception, _dependencyProperty.Name, target.GetType().FullName, ((AnimationClock)sender).Timeline.GetType().FullName), e); } } }
// Token: 0x060064D6 RID: 25814 RVA: 0x001C48A4 File Offset: 0x001C2AA4 internal static void SetItemValuesOnContainer(DependencyObject owner, DependencyObject container, object item) { int[] itemValueStorageIndices = Helper.ItemValueStorageIndices; List <KeyValuePair <int, object> > list = Helper.GetItemValues(owner, item) ?? new List <KeyValuePair <int, object> >(); foreach (int num in itemValueStorageIndices) { DependencyProperty dependencyProperty = DependencyProperty.RegisteredPropertyList.List[num]; object obj = DependencyProperty.UnsetValue; for (int j = 0; j < list.Count; j++) { if (list[j].Key == num) { obj = list[j].Value; break; } } if (dependencyProperty != null) { if (obj != DependencyProperty.UnsetValue) { Helper.ModifiedItemValue modifiedItemValue = obj as Helper.ModifiedItemValue; if (modifiedItemValue == null) { container.SetValue(dependencyProperty, obj); } else if (modifiedItemValue.IsCoercedWithCurrentValue) { container.SetCurrentValue(dependencyProperty, modifiedItemValue.Value); } } else if (container != container.GetValue(ItemContainerGenerator.ItemForItemContainerProperty)) { EntryIndex entryIndex = container.LookupEntry(num); EffectiveValueEntry effectiveValueEntry = new EffectiveValueEntry(dependencyProperty); if (entryIndex.Found) { effectiveValueEntry = container.EffectiveValues[(int)entryIndex.Index]; if (effectiveValueEntry.IsCoercedWithCurrentValue) { container.InvalidateProperty(dependencyProperty, false); entryIndex = container.LookupEntry(num); if (entryIndex.Found) { effectiveValueEntry = container.EffectiveValues[(int)entryIndex.Index]; } } } if (entryIndex.Found && (effectiveValueEntry.BaseValueSourceInternal == BaseValueSourceInternal.Local || effectiveValueEntry.BaseValueSourceInternal == BaseValueSourceInternal.ParentTemplate) && !effectiveValueEntry.HasModifiers) { container.ClearValue(dependencyProperty); } } } else if (obj != DependencyProperty.UnsetValue) { EntryIndex entryIndex2 = container.LookupEntry(num); container.SetEffectiveValue(entryIndex2, null, num, null, obj, BaseValueSourceInternal.Local); } } }