/// <summary> /// This method is called when the cached value of the resource has /// been invalidated. E.g. after a new Resources property is set somewhere /// in the ancestory. /// </summary> private void InvalidateCacheValue() { object resource = _cachedResourceValue; // If the old value was a DeferredResourceReference, it should be // removed from its Dictionary's list to avoid a leak (bug 1624666). DeferredResourceReference deferredResourceReference = _cachedResourceValue as DeferredResourceReference; if (deferredResourceReference != null) { if (deferredResourceReference.IsInflated) { // use the inflated value for the Freezable test below resource = deferredResourceReference.Value; } else { // stop listening for the Inflated event if (ReadInternalState(InternalState.IsListeningForInflated)) { deferredResourceReference.RemoveInflatedListener(this); WriteInternalState(InternalState.IsListeningForInflated, false); } } deferredResourceReference.RemoveFromDictionary(); } StopListeningForFreezableChanges(resource); _cachedResourceValue = null; WriteInternalState(InternalState.HasCachedResourceValue, false); }
// Token: 0x0600087A RID: 2170 RVA: 0x0001BA78 File Offset: 0x00019C78 private void InvalidateCacheValue() { object resource = this._cachedResourceValue; DeferredResourceReference deferredResourceReference = this._cachedResourceValue as DeferredResourceReference; if (deferredResourceReference != null) { if (deferredResourceReference.IsInflated) { resource = deferredResourceReference.Value; } else if (this.ReadInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated)) { deferredResourceReference.RemoveInflatedListener(this); this.WriteInternalState(ResourceReferenceExpression.InternalState.IsListeningForInflated, false); } deferredResourceReference.RemoveFromDictionary(); } this.StopListeningForFreezableChanges(resource); this._cachedResourceValue = null; this.WriteInternalState(ResourceReferenceExpression.InternalState.HasCachedResourceValue, false); }